Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: sparse endian fixes

Fix a couple of endian annotation in net/netfilter:

net/netfilter/nfnetlink_acct.c:82:30: warning: cast to restricted __be64
net/netfilter/nfnetlink_acct.c:86:30: warning: cast to restricted __be64
net/netfilter/nfnetlink_cthelper.c:77:28: warning: cast to restricted __be16
net/netfilter/xt_NFQUEUE.c:46:16: warning: restricted __be32 degrades to integer
net/netfilter/xt_NFQUEUE.c:60:34: warning: restricted __be32 degrades to integer
net/netfilter/xt_NFQUEUE.c:68:34: warning: restricted __be32 degrades to integer
net/netfilter/xt_osf.c:272:55: warning: cast to restricted __be16

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Patrick McHardy and committed by
Pablo Neira Ayuso
fe31d1a8 19e303d6

+9 -7
+5 -3
net/netfilter/xt_NFQUEUE.c
··· 43 43 const struct iphdr *iph = ip_hdr(skb); 44 44 45 45 /* packets in either direction go into same queue */ 46 - if (iph->saddr < iph->daddr) 46 + if ((__force u32)iph->saddr < (__force u32)iph->daddr) 47 47 return jhash_3words((__force u32)iph->saddr, 48 48 (__force u32)iph->daddr, iph->protocol, jhash_initval); 49 49 ··· 57 57 const struct ipv6hdr *ip6h = ipv6_hdr(skb); 58 58 u32 a, b, c; 59 59 60 - if (ip6h->saddr.s6_addr32[3] < ip6h->daddr.s6_addr32[3]) { 60 + if ((__force u32)ip6h->saddr.s6_addr32[3] < 61 + (__force u32)ip6h->daddr.s6_addr32[3]) { 61 62 a = (__force u32) ip6h->saddr.s6_addr32[3]; 62 63 b = (__force u32) ip6h->daddr.s6_addr32[3]; 63 64 } else { ··· 66 65 a = (__force u32) ip6h->daddr.s6_addr32[3]; 67 66 } 68 67 69 - if (ip6h->saddr.s6_addr32[1] < ip6h->daddr.s6_addr32[1]) 68 + if ((__force u32)ip6h->saddr.s6_addr32[1] < 69 + (__force u32)ip6h->daddr.s6_addr32[1]) 70 70 c = (__force u32) ip6h->saddr.s6_addr32[1]; 71 71 else 72 72 c = (__force u32) ip6h->daddr.s6_addr32[1];
+1 -1
net/netfilter/xt_osf.c
··· 269 269 mss <<= 8; 270 270 mss |= optp[2]; 271 271 272 - mss = ntohs(mss); 272 + mss = ntohs((__force __be16)mss); 273 273 break; 274 274 case OSFOPT_TS: 275 275 loop_cont = 1;