Bug 229664 - src/sys/netinet/tcp_stacks/rack.c: 2 * poor error checking ?
Summary: src/sys/netinet/tcp_stacks/rack.c: 2 * poor error checking ?
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: Normal Affects Some People
Assignee: Michael Tuexen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-10 06:47 UTC by David Binderman
Modified: 2018-12-04 22:07 UTC (History)
3 users (show)

See Also:
tuexen: mfc-stable12+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2018-07-10 06:47:02 UTC
1.

src/sys/netinet/tcp_stacks/rack.c:7125]: (style) Unsigned variable 'sb_offset' can't be negative so it is unnecessary to test it.

Source code is

        KASSERT(sb_offset >= 0, ("%s: sack block to the left of una : %d",
                    __func__, sb_offset));

if sb_offset can be negative, then using an unsigned type for it 
looks wrong. Suggest use signed type.

2.

src/sys/netinet/tcp_stacks/rack.c:7172]: (style) Unsigned variable 'sb_offset' can't be negative so it is unnecessary to test it.

Duplicate.
Comment 1 Michael Tuexen freebsd_committer freebsd_triage 2018-11-17 20:43:42 UTC
A patch is under review D18021.
Comment 2 commit-hook freebsd_committer freebsd_triage 2018-11-21 18:19:53 UTC
A commit references this bug:

Author: tuexen
Date: Wed Nov 21 18:19:16 UTC 2018
New revision: 340738
URL: https://svnweb.freebsd.org/changeset/base/340738

Log:
  Improve two KASSERTs in the TCP RACK stack.

  There are two locations where an always true comparison was made in
  a KASSERT. Replace this by an appropriate check and use a consistent
  panic message. Also use this code when checking a similar condition.

  PR:			229664
  Reviewed by:		rrs@
  MFC after:		1 week
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D18021

Changes:
  head/sys/netinet/tcp_stacks/rack.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-12-04 22:06:08 UTC
A commit references this bug:

Author: tuexen
Date: Tue Dec  4 22:05:36 UTC 2018
New revision: 341497
URL: https://svnweb.freebsd.org/changeset/base/341497

Log:
  MFC r340738:

  Improve two KASSERTs in the TCP RACK stack.

  There are two locations where an always true comparison was made in
  a KASSERT. Replace this by an appropriate check and use a consistent
  panic message. Also use this code when checking a similar condition.

  PR:			229664
  Reviewed by:		rrs@
  MFC after:		1 week
  Sponsored by:		Netflix, Inc.
  Differential Revision:	https://reviews.freebsd.org/D18021

Changes:
_U  stable/12/
  stable/12/sys/netinet/tcp_stacks/rack.c