From 55126001d825cd2f25f79cb92b74cb3cfa958071 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 22 Aug 2009 16:06:14 -0700 Subject: [PATCH] AMD64 - Fix unsigned promotion that was meant to be a signed promotion * When casting the result if a TCP sequence space difference to a long we must first cast to tcp_seq_diff_t or the promotion will not sign-extend the result. --- sys/netinet/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 74e7ce13cd..05c5500ad3 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -859,8 +859,8 @@ send: if (recvwin < (long)(so->so_rcv.ssb_hiwat / 4) && recvwin < (long)tp->t_maxseg) recvwin = 0; - if (recvwin < (long)(tp->rcv_adv - tp->rcv_nxt)) - recvwin = (long)(tp->rcv_adv - tp->rcv_nxt); + if (recvwin < (tcp_seq_diff_t)(tp->rcv_adv - tp->rcv_nxt)) + recvwin = (tcp_seq_diff_t)(tp->rcv_adv - tp->rcv_nxt); if (recvwin > (long)TCP_MAXWIN << tp->rcv_scale) recvwin = (long)TCP_MAXWIN << tp->rcv_scale; th->th_win = htons((u_short) (recvwin>>tp->rcv_scale)); -- 2.41.0