linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [-mm PATCH][3/4] net: signed vs unsigned cleanup in net/ipv4/raw.c
@ 2005-06-15 21:31 Jesper Juhl
  0 siblings, 0 replies; only message in thread
From: Jesper Juhl @ 2005-06-15 21:31 UTC (permalink / raw)
  To: David S. Miller
  Cc: Hideaki YOSHIFUJI, Alexey Kuznetsov, James Morris, Ross Biro,
	netdev, linux-kernel

This patch changes the type of the local variable 'i' in 
raw_probe_proto_opt() from 'int' to 'unsigned int'. The only use of 'i' in 
this function is as a counter in a for() loop and subsequent index into 
the msg->msg_iov[] array.
Since 'i' is compared in a loop to the unsigned variable msg->msg_iovlen 
gcc -W generates this warning : 

net/ipv4/raw.c:340: warning: comparison between signed and unsigned

Changing 'i' to unsigned silences this warning and is safe since the array 
index can never be negative anyway, so unsigned int is the logical type to 
use for 'i' and also enables a larger msg_iov[] array (but I don't know if 
that will ever matter).


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---

 net/ipv4/raw.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.12-rc6-mm1/net/ipv4/raw.c.with_patch-2	2005-06-15 23:04:40.000000000 +0200
+++ linux-2.6.12-rc6-mm1/net/ipv4/raw.c	2005-06-15 23:09:42.000000000 +0200
@@ -332,7 +332,7 @@ static void raw_probe_proto_opt(struct f
 	u8 __user *type = NULL;
 	u8 __user *code = NULL;
 	int probed = 0;
-	int i;
+	unsigned int i;
 
 	if (!msg->msg_iov)
 		return;




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-15 21:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-15 21:31 [-mm PATCH][3/4] net: signed vs unsigned cleanup in net/ipv4/raw.c Jesper Juhl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).