AMD64 - Fix unsigned promotion that was meant to be a signed promotion
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 22 Aug 2009 23:06:14 +0000 (16:06 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 22 Aug 2009 23:06:14 +0000 (16:06 -0700)
* 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

index 74e7ce1..05c5500 100644 (file)
@@ -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));