Don't overpromote values when calculating len in tcp_output().

sbavail() returns u_int and sendwin is a uint32_t. Therefore, min() (which
operates on two u_int values) is able to correctly calculate the minimum
of these two arguments.

Reported by:	rrs
MFC after:	1 week
Sponsored by:	Netflix
This commit is contained in:
jtl 2017-07-05 16:10:30 +00:00
parent b4b1c0c6e1
commit 55bc1e6207

View File

@ -386,7 +386,7 @@ tcp_output(struct tcpcb *tp)
*/
if (sack_rxmit == 0) {
if (sack_bytes_rxmt == 0)
len = ((int32_t)ulmin(sbavail(&so->so_snd), sendwin) -
len = ((int32_t)min(sbavail(&so->so_snd), sendwin) -
off);
else {
int32_t cwin;