[IPV4]: [4/4] signed vs unsigned cleanup in net/ipv4/raw.c
authorJesper Juhl <juhl-lkml@dif.dk>
Sun, 19 Jun 2005 06:00:34 +0000 (23:00 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Jun 2005 06:00:34 +0000 (23:00 -0700)
This patch changes the type of the third parameter 'length' of the
raw_send_hdrinc() function from 'int' to 'size_t'.
This makes sense since this function is only ever called from one
location, and the value passed as the third parameter in that location is
itself of type size_t, so this makes the recieving functions parameter
type match. Also, inside raw_send_hdrinc() the 'length' variable is
used in comparisons with unsigned values and passed as parameter to
functions expecting unsigned values (it's used in a single comparison with
a signed value, but that one can never actually be negative so the patch
also casts that one to size_t to stop gcc worrying, and it is passed in a
single instance to memcpy_fromiovecend() which expects a signed int, but
as far as I can see that's not a problem since the value of 'length'
shouldn't ever exceed the value of a signed int).

Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/raw.c

index 085a08ea5a5ef713661cb245c158eabc08089a5c..d1835b1bc8c469d8394e0ae1a0bb8c9b9a6f975c 100644 (file)
@@ -259,7 +259,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb)
        return 0;
 }
 
-static int raw_send_hdrinc(struct sock *sk, void *from, int length,
+static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
                        struct rtable *rt, 
                        unsigned int flags)
 {
@@ -298,7 +298,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length,
                goto error_fault;
 
        /* We don't modify invalid header */
-       if (length >= sizeof(*iph) && iph->ihl * 4 <= length) {
+       if (length >= sizeof(*iph) && iph->ihl * 4U <= length) {
                if (!iph->saddr)
                        iph->saddr = rt->rt_src;
                iph->check   = 0;
This page took 0.04082 seconds and 5 git commands to generate.