]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC 301932: Use sbused() instead of sbspace() to avoid signed issues.
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 4 Nov 2016 04:01:59 +0000 (04:01 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Fri, 4 Nov 2016 04:01:59 +0000 (04:01 +0000)
commit0c32a98b59c57dd5eddb6cb16e902da69ffa4dd4
tree975845009e0d835608fc3a877ed68c534b5b0c4e
parentd8ea5d9d3a8be5179095da512c8a49814a2248f2
MFC 301932: Use sbused() instead of sbspace() to avoid signed issues.

Inserting a full mbuf with an external cluster into the socket buffer
resulted in sbspace() returning -MLEN.  However, since sb_hiwat is
unsigned, the -MLEN value was converted to unsigned in comparisons.  As a
result, the socket buffer was never autosized.  Note that sb_lowat is signed
to permit direct comparisons with sbspace(), but sb_hiwat is unsigned.
Follow suit with what tcp_output() does and compare the value of sbused()
with sb_hiwat instead.

Note: Since stable/10 does not include sbused(), this uses sb->sb_cc
instead.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@308283 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/dev/cxgbe/tom/t4_cpl_io.c