From: Jesper Juhl Date: Sun, 19 Jun 2005 06:00:15 +0000 (-0700) Subject: [IPV4]: [3/4] signed vs unsigned cleanup in net/ipv4/raw.c X-Git-Tag: v2.6.13-rc1~90^2~583^2~9 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93765d8a435fa021c4b7cd0521b7959239d7158a;p=linux-2.6 [IPV4]: [3/4] signed vs unsigned cleanup in net/ipv4/raw.c 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 Signed-off-by: David S. Miller --- diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 1fcb23d335..085a08ea5a 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -332,7 +332,7 @@ static void raw_probe_proto_opt(struct flowi *fl, struct msghdr *msg) u8 __user *type = NULL; u8 __user *code = NULL; int probed = 0; - int i; + unsigned int i; if (!msg->msg_iov) return;