[PATCH 2.4.23-pre3] signed/unsigned mismatches in include/net/tcp.h

From: Rolf Eike Beer
Date: Mon Sep 08 2003 - 10:28:14 EST


Hi,

the first one in tcp.h fixes a warning with gcc 3.3: we compare signed with
unsigned. rto is unsigned, so maybe we should cast the left side to u32.

Number 2 changes the type of mss from int to unsigned int. mss is only used to
compare with sbk->len, which is an unsigned. Both callers of this function
use unsigned variables at this point anyway (one is tcp_send_skb from #3).

Please review.

Eike

diff -Naur linux-2.4.23-pre3/include/net/tcp.h linux-2.4.23-pre3-caliban/include/net/tcp.h
--- linux-2.4.23-pre3/include/net/tcp.h 2003-09-05 15:04:50.000000000 +0200
+++ linux-2.4.23-pre3-caliban/include/net/tcp.h 2003-09-07 18:26:50.000000000 +0200
@@ -1123,7 +1123,7 @@
if (tp->packets_out > tp->snd_cwnd_used)
tp->snd_cwnd_used = tp->packets_out;

- if ((s32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto)
+ if ((u32)(tcp_time_stamp - tp->snd_cwnd_stamp) >= tp->rto)
tcp_cwnd_application_limited(sk);
}
}
@@ -1166,7 +1166,7 @@
!after(tp->snd_sml, tp->snd_nxt);
}

-static __inline__ void tcp_minshall_update(struct tcp_opt *tp, int mss, struct sk_buff *skb)
+static __inline__ void tcp_minshall_update(struct tcp_opt *tp, unsigned int mss, struct sk_buff *skb)
{
if (skb->len < mss)
tp->snd_sml = TCP_SKB_CB(skb)->end_seq;
diff -Naur linux-2.4.23-pre3/net/ipv4/tcp_output.c linux-2.4.23-pre3-caliban/net/ipv4/tcp_output.c
--- linux-2.4.23-pre3/net/ipv4/tcp_output.c 2003-09-05 15:04:52.000000000 +0200
+++ linux-2.4.23-pre3-caliban/net/ipv4/tcp_output.c 2003-09-07 18:17:04.000000000 +0200
@@ -302,7 +302,7 @@
* NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames,
* otherwise socket can stall.
*/
-void tcp_send_skb(struct sock *sk, struct sk_buff *skb, int force_queue, unsigned cur_mss)
+void tcp_send_skb(struct sock *sk, struct sk_buff *skb, int force_queue, unsigned int cur_mss)
{
struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/