diff options
author | Jesper Juhl <juhl-lkml@dif.dk> | 2005-06-19 02:00:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-06-19 02:00:34 -0400 |
commit | f7d7fc0322c1770fe7ee836ca2732c2f88e2e1a4 (patch) | |
tree | e156e26ed6a756ab347c9c4d688d9328ec44b633 /net/ipv4/raw.c | |
parent | 93765d8a435fa021c4b7cd0521b7959239d7158a (diff) |
[IPV4]: [4/4] signed vs unsigned cleanup in net/ipv4/raw.c
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>
Diffstat (limited to 'net/ipv4/raw.c')
-rw-r--r-- | net/ipv4/raw.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 085a08ea5a5e..d1835b1bc8c4 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -259,7 +259,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) | |||
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
261 | 261 | ||
262 | static int raw_send_hdrinc(struct sock *sk, void *from, int length, | 262 | static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, |
263 | struct rtable *rt, | 263 | struct rtable *rt, |
264 | unsigned int flags) | 264 | unsigned int flags) |
265 | { | 265 | { |
@@ -298,7 +298,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, int length, | |||
298 | goto error_fault; | 298 | goto error_fault; |
299 | 299 | ||
300 | /* We don't modify invalid header */ | 300 | /* We don't modify invalid header */ |
301 | if (length >= sizeof(*iph) && iph->ihl * 4 <= length) { | 301 | if (length >= sizeof(*iph) && iph->ihl * 4U <= length) { |
302 | if (!iph->saddr) | 302 | if (!iph->saddr) |
303 | iph->saddr = rt->rt_src; | 303 | iph->saddr = rt->rt_src; |
304 | iph->check = 0; | 304 | iph->check = 0; |