Skip to contentSkip to conversation

signed/unsigned mismatches in include/net/tcp.h

PATCH New Rolf Eike Beer 1 participant 1 message Sep 8, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 signed/unsigned mismatches in include/net/tcp.h

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

include/net/tcp.h +2 -2
diff -Naur linux-2.4.23-pre3/include/net/tcp.h linux-2.4.23-pre3-caliban/include/net/tcp.h
@@ -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;
net/ipv4/tcp_output.c +1 -1
diff -Naur linux-2.4.23-pre3/net/ipv4/tcp_output.c linux-2.4.23-pre3-caliban/net/ipv4/tcp_output.c
@@ -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);