Commit fe31d1a8605f020eee859375fdd877186e01b804
Committed by
Pablo Neira Ayuso
1 parent
19e303d67d
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>
Showing 4 changed files with 9 additions and 7 deletions Side-by-side Diff
net/netfilter/nfnetlink_acct.c
... | ... | @@ -79,11 +79,11 @@ |
79 | 79 | |
80 | 80 | if (tb[NFACCT_BYTES]) { |
81 | 81 | atomic64_set(&nfacct->bytes, |
82 | - be64_to_cpu(nla_get_u64(tb[NFACCT_BYTES]))); | |
82 | + be64_to_cpu(nla_get_be64(tb[NFACCT_BYTES]))); | |
83 | 83 | } |
84 | 84 | if (tb[NFACCT_PKTS]) { |
85 | 85 | atomic64_set(&nfacct->pkts, |
86 | - be64_to_cpu(nla_get_u64(tb[NFACCT_PKTS]))); | |
86 | + be64_to_cpu(nla_get_be64(tb[NFACCT_PKTS]))); | |
87 | 87 | } |
88 | 88 | atomic_set(&nfacct->refcnt, 1); |
89 | 89 | list_add_tail_rcu(&nfacct->head, &nfnl_acct_list); |
net/netfilter/nfnetlink_cthelper.c
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) |
75 | 75 | return -EINVAL; |
76 | 76 | |
77 | - tuple->src.l3num = ntohs(nla_get_u16(tb[NFCTH_TUPLE_L3PROTONUM])); | |
77 | + tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM])); | |
78 | 78 | tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); |
79 | 79 | |
80 | 80 | return 0; |
net/netfilter/xt_NFQUEUE.c
... | ... | @@ -43,7 +43,7 @@ |
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,7 +57,8 @@ |
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 { |
... | ... | @@ -65,7 +66,8 @@ |
65 | 66 | a = (__force u32) ip6h->daddr.s6_addr32[3]; |
66 | 67 | } |
67 | 68 | |
68 | - if (ip6h->saddr.s6_addr32[1] < ip6h->daddr.s6_addr32[1]) | |
69 | + if ((__force u32)ip6h->saddr.s6_addr32[1] < | |
70 | + (__force u32)ip6h->daddr.s6_addr32[1]) | |
69 | 71 | c = (__force u32) ip6h->saddr.s6_addr32[1]; |
70 | 72 | else |
71 | 73 | c = (__force u32) ip6h->daddr.s6_addr32[1]; |