diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-11-11 00:53:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-11-11 00:53:30 -0500 |
commit | 78608ba0326f1448f9a10dbb402a38192559f639 (patch) | |
tree | beed02e8e886be6a9661e9eb6ca60cc1208c59d2 /include/linux/skbuff.h | |
parent | 39aaac114e192bce500204f9c9e1fffff4c2b519 (diff) |
[NET]: Fix skb_truesize_check() assertion
The intent of the assertion in skb_truesize_check() is to check
for skb->truesize being decremented too much by other code,
resulting in a wraparound below zero.
The type of the right side of the comparison causes the compiler to
promote the left side to an unsigned type, despite the presence of an
explicit type cast. This defeats the check for negativity.
Ensure both sides of the comparison are a signed type to prevent the
implicit type conversion.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 94e49915a8c0..91140fe8c119 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -387,7 +387,9 @@ extern void skb_truesize_bug(struct sk_buff *skb); | |||
387 | 387 | ||
388 | static inline void skb_truesize_check(struct sk_buff *skb) | 388 | static inline void skb_truesize_check(struct sk_buff *skb) |
389 | { | 389 | { |
390 | if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len)) | 390 | int len = sizeof(struct sk_buff) + skb->len; |
391 | |||
392 | if (unlikely((int)skb->truesize < len)) | ||
391 | skb_truesize_bug(skb); | 393 | skb_truesize_bug(skb); |
392 | } | 394 | } |
393 | 395 | ||