netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NET: Remove unneeded type cast in skb_truesize_check()
@ 2007-11-02 19:14 Chuck Lever
  2007-11-02 21:27 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Chuck Lever @ 2007-11-02 19:14 UTC (permalink / raw)
  To: netdev

The (int) type cast in skb_truesize_check() is unneeded: without it, all
the variable types in the conditional expression are unsigned integers.  As
it stands, the type cast causes a comparison between a signed and an
unsigned integer, which can produce unexpected results.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 include/linux/skbuff.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 94e4991..7965216 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -387,7 +387,7 @@ extern void	      skb_truesize_bug(struct sk_buff *skb);
 
 static inline void skb_truesize_check(struct sk_buff *skb)
 {
-	if (unlikely((int)skb->truesize < sizeof(struct sk_buff) + skb->len))
+	if (unlikely(skb->truesize < sizeof(struct sk_buff) + skb->len))
 		skb_truesize_bug(skb);
 }
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-11-08  0:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-02 19:14 [PATCH] NET: Remove unneeded type cast in skb_truesize_check() Chuck Lever
2007-11-02 21:27 ` David Miller
2007-11-05 23:59   ` Chuck Lever
2007-11-06  0:33     ` David Miller
2007-11-07 15:11       ` Chuck Lever
2007-11-08  0:15         ` David Miller

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).