diff options
author | Eric Dumazet <edumazet@google.com> | 2012-12-02 02:33:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-02 20:23:01 -0500 |
commit | 077b393d05915f04e2629bfc47c6fce95cae7d3f (patch) | |
tree | 5eac1986bc8d1d8dd4cef0b0c07909773ecc3ebf /include/net | |
parent | 049b467d7a57e7b978ce063ee3639670f383fb5c (diff) |
net: fix sparse endianness warnings on sock_common
# 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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/inet_hashtables.h | 2 | ||||
-rw-r--r-- | 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 d1de4fbd45c2..67a8fa098e3a 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, | |||
277 | On 64bit targets we combine comparisons with pair of adjacent __be32 | 277 | On 64bit targets we combine comparisons with pair of adjacent __be32 |
278 | fields in the same way. | 278 | fields in the same way. |
279 | */ | 279 | */ |
280 | typedef __u32 __bitwise __portpair; | ||
281 | #ifdef __BIG_ENDIAN | 280 | #ifdef __BIG_ENDIAN |
282 | #define INET_COMBINED_PORTS(__sport, __dport) \ | 281 | #define INET_COMBINED_PORTS(__sport, __dport) \ |
283 | ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport))) | 282 | ((__force __portpair)(((__force __u32)(__be16)(__sport) << 16) | (__u32)(__dport))) |
@@ -287,7 +286,6 @@ typedef __u32 __bitwise __portpair; | |||
287 | #endif | 286 | #endif |
288 | 287 | ||
289 | #if (BITS_PER_LONG == 64) | 288 | #if (BITS_PER_LONG == 64) |
290 | typedef __u64 __bitwise __addrpair; | ||
291 | #ifdef __BIG_ENDIAN | 289 | #ifdef __BIG_ENDIAN |
292 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ | 290 | #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ |
293 | const __addrpair __name = (__force __addrpair) ( \ | 291 | const __addrpair __name = (__force __addrpair) ( \ |
diff --git a/include/net/sock.h b/include/net/sock.h index c4132c1b63a8..0a9a01a5b0d7 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -126,6 +126,9 @@ struct sock; | |||
126 | struct proto; | 126 | struct proto; |
127 | struct net; | 127 | struct net; |
128 | 128 | ||
129 | typedef __u32 __bitwise __portpair; | ||
130 | typedef __u64 __bitwise __addrpair; | ||
131 | |||
129 | /** | 132 | /** |
130 | * struct sock_common - minimal network layer representation of sockets | 133 | * struct sock_common - minimal network layer representation of sockets |
131 | * @skc_daddr: Foreign IPv4 addr | 134 | * @skc_daddr: Foreign IPv4 addr |
@@ -155,7 +158,7 @@ struct sock_common { | |||
155 | * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH() | 158 | * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH() |
156 | */ | 159 | */ |
157 | union { | 160 | union { |
158 | unsigned long skc_addrpair; | 161 | __addrpair skc_addrpair; |
159 | struct { | 162 | struct { |
160 | __be32 skc_daddr; | 163 | __be32 skc_daddr; |
161 | __be32 skc_rcv_saddr; | 164 | __be32 skc_rcv_saddr; |
@@ -167,7 +170,7 @@ struct sock_common { | |||
167 | }; | 170 | }; |
168 | /* skc_dport && skc_num must be grouped as well */ | 171 | /* skc_dport && skc_num must be grouped as well */ |
169 | union { | 172 | union { |
170 | u32 skc_portpair; | 173 | __portpair skc_portpair; |
171 | struct { | 174 | struct { |
172 | __be16 skc_dport; | 175 | __be16 skc_dport; |
173 | __u16 skc_num; | 176 | __u16 skc_num; |