Bug 229664

Summary: src/sys/netinet/tcp_stacks/rack.c: 2 * poor error checking ?
Product: Base System Reporter: David Binderman <dcb314>
Component: kernAssignee: Michael Tuexen <tuexen>
Status: Closed FIXED    
Severity: Affects Some People CC: markj, rrs, tuexen
Priority: Normal Flags: tuexen: mfc-stable12+
Version: CURRENT   
Hardware: Any   
OS: Any   

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 2018-11-17 20:43:42 UTC
A patch is under review D18021.
Comment 2 commit-hook freebsd_committer 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 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