netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: fix sparse endianness warnings on sock_common
@ 2012-12-02 17:33 Eric Dumazet
  2012-12-03  1:23 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2012-12-02 17:33 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Fengguang Wu, Ling Ma

From: Eric Dumazet <edumazet@google.com>

# make C=2 CF=-D__CHECK_ENDIAN__ net/ipv4/inet_hashtables.o
...
net/ipv4/inet_hashtables.c:242:7: warning: restricted __portpair degrades to integer
net/ipv4/inet_hashtables.c:242:7: warning: restricted __addrpair degrades to integer
...

Move __portpair/__addrpair from include/net/inet_hashtables.h
to include/net/sock.h where we need them in struct sock_common

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Ling Ma <ling.ma.program@gmail.com>
---
 include/net/inet_hashtables.h |    2 --
 include/net/sock.h            |    7 +++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index d1de4fb..67a8fa0 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -277,7 +277,6 @@ static inline struct sock *inet_lookup_listener(struct net *net,
    On 64bit targets we combine comparisons with pair of adjacent __be32
    fields in the same way.
 */
-typedef __u32 __bitwise __portpair;
 #ifdef __BIG_ENDIAN
 #define INET_COMBINED_PORTS(__sport, __dport) \
 	((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport)))
@@ -287,7 +286,6 @@ typedef __u32 __bitwise __portpair;
 #endif
 
 #if (BITS_PER_LONG == 64)
-typedef __u64 __bitwise __addrpair;
 #ifdef __BIG_ENDIAN
 #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
 	const __addrpair __name = (__force __addrpair) ( \
diff --git a/include/net/sock.h b/include/net/sock.h
index c4132c1..0a9a01a 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -126,6 +126,9 @@ struct sock;
 struct proto;
 struct net;
 
+typedef __u32 __bitwise __portpair;
+typedef __u64 __bitwise __addrpair;
+
 /**
  *	struct sock_common - minimal network layer representation of sockets
  *	@skc_daddr: Foreign IPv4 addr
@@ -155,7 +158,7 @@ struct sock_common {
 	 * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH()
 	 */
 	union {
-		unsigned long	skc_addrpair;
+		__addrpair	skc_addrpair;
 		struct {
 			__be32	skc_daddr;
 			__be32	skc_rcv_saddr;
@@ -167,7 +170,7 @@ struct sock_common {
 	};
 	/* skc_dport && skc_num must be grouped as well */
 	union {
-		u32		skc_portpair;
+		__portpair	skc_portpair;
 		struct {
 			__be16	skc_dport;
 			__u16	skc_num;

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

* Re: [PATCH net-next] net: fix sparse endianness warnings on sock_common
  2012-12-02 17:33 [PATCH net-next] net: fix sparse endianness warnings on sock_common Eric Dumazet
@ 2012-12-03  1:23 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-12-03  1:23 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, fengguang.wu, ling.ma.program

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 02 Dec 2012 09:33:10 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> # make C=2 CF=-D__CHECK_ENDIAN__ net/ipv4/inet_hashtables.o
> ...
> net/ipv4/inet_hashtables.c:242:7: warning: restricted __portpair degrades to integer
> net/ipv4/inet_hashtables.c:242:7: warning: restricted __addrpair degrades to integer
> ...
> 
> Move __portpair/__addrpair from include/net/inet_hashtables.h
> to include/net/sock.h where we need them in struct sock_common
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

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

end of thread, other threads:[~2012-12-03  1:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-02 17:33 [PATCH net-next] net: fix sparse endianness warnings on sock_common Eric Dumazet
2012-12-03  1:23 ` 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).