All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] include/linux/skbuff.h: using '0xffff' instead of '~0U'
@ 2013-05-30  6:03 Chen Gang
  2013-05-30  9:55 ` Chen Gang
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Chen Gang @ 2013-05-30  6:03 UTC (permalink / raw)
  To: edumazet, Pravin Shelar, mgorman
  Cc: David Miller, Andrew Morton, linux-kernel, netdev


Both 'transport_header' and 'mac_header' are u16, which are never equal
to '~0U'.

So need use '0xffff' instead of '~0U'.

The related warning (with EXTRA_CFLAGS=-W ARCH=m68k for allmodconfig)
  include/linux/skbuff.h:1587:2: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  ...


Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 include/linux/skbuff.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 2e0ced1..03ba058 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1581,7 +1581,7 @@ static inline void skb_set_inner_mac_header(struct sk_buff *skb,
 }
 static inline bool skb_transport_header_was_set(const struct sk_buff *skb)
 {
-	return skb->transport_header != ~0U;
+	return skb->transport_header != 0xffff;
 }
 
 static inline unsigned char *skb_transport_header(const struct sk_buff *skb)
@@ -1624,7 +1624,7 @@ static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
 
 static inline int skb_mac_header_was_set(const struct sk_buff *skb)
 {
-	return skb->mac_header != ~0U;
+	return skb->mac_header != 0xffff;
 }
 
 static inline void skb_reset_mac_header(struct sk_buff *skb)
-- 
1.7.7.6

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

end of thread, other threads:[~2013-06-05 11:16 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-30  6:03 [PATCH] include/linux/skbuff.h: using '0xffff' instead of '~0U' Chen Gang
2013-05-30  9:55 ` Chen Gang
2013-05-30 15:30 ` Ben Hutchings
2013-06-03  8:52   ` Chen Gang
2013-05-31 21:05 ` Andy Shevchenko
2013-06-03  9:23   ` Chen Gang
2013-06-03 10:14     ` Andy Shevchenko
2013-06-03 10:51       ` Chen Gang
2013-06-03 11:24         ` [PATCH v2] include/linux/skbuff.h: using '(u16) ~0U' " Chen Gang
2013-06-03 11:34           ` Andy Shevchenko
2013-06-03 11:46             ` Chen Gang
2013-06-03 12:26           ` David Laight
2013-06-03 12:26             ` David Laight
2013-06-03 12:47             ` David Laight
2013-06-03 12:47               ` David Laight
2013-06-05  0:44               ` Chen Gang
2013-06-05  0:54                 ` [PATCH v3] include/linux/skbuff.h: using '(__u16) " Chen Gang
2013-06-05  8:36                   ` David Miller
2013-06-05 11:15                     ` Chen Gang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.