aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2013-10-28 06:19:45 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2013-10-28 12:41:49 -0400
commit98c37b6b01812d331db4d49cacd603891d0d53ba (patch)
tree60e0a8e535e10ca1e16b798c5d5384c77d39031d /net/netfilter
parent6e078bc2f2406ccbb986a9922cc80ae8ca7abca3 (diff)
netfilter: nft_nat: Fix endianness issue reported by sparse
This patch fixes this: CHECK net/netfilter/nft_nat.c net/netfilter/nft_nat.c:50:43: warning: incorrect type in assignment (different base types) net/netfilter/nft_nat.c:50:43: expected restricted __be32 [addressable] [usertype] ip net/netfilter/nft_nat.c:50:43: got unsigned int [unsigned] [usertype] <noident> net/netfilter/nft_nat.c:51:43: warning: incorrect type in assignment (different base types) net/netfilter/nft_nat.c:51:43: expected restricted __be32 [addressable] [usertype] ip net/netfilter/nft_nat.c:51:43: got unsigned int [unsigned] [usertype] <noident> net/netfilter/nft_nat.c:65:37: warning: incorrect type in assignment (different base types) net/netfilter/nft_nat.c:65:37: expected restricted __be16 [addressable] [assigned] [usertype] all net/netfilter/nft_nat.c:65:37: got unsigned int [unsigned] <noident> net/netfilter/nft_nat.c:66:37: warning: incorrect type in assignment (different base types) net/netfilter/nft_nat.c:66:37: expected restricted __be16 [addressable] [assigned] [usertype] all net/netfilter/nft_nat.c:66:37: got unsigned int [unsigned] <noident> Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nft_nat.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index b0b87b2d2411..d3b1ffe26181 100644
--- a/net/netfilter/nft_nat.c
+++ b/net/netfilter/nft_nat.c
@@ -47,8 +47,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
47 memset(&range, 0, sizeof(range)); 47 memset(&range, 0, sizeof(range));
48 if (priv->sreg_addr_min) { 48 if (priv->sreg_addr_min) {
49 if (priv->family == AF_INET) { 49 if (priv->family == AF_INET) {
50 range.min_addr.ip = data[priv->sreg_addr_min].data[0]; 50 range.min_addr.ip = (__force __be32)
51 range.max_addr.ip = data[priv->sreg_addr_max].data[0]; 51 data[priv->sreg_addr_min].data[0];
52 range.max_addr.ip = (__force __be32)
53 data[priv->sreg_addr_max].data[0];
52 54
53 } else { 55 } else {
54 memcpy(range.min_addr.ip6, 56 memcpy(range.min_addr.ip6,
@@ -62,8 +64,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
62 } 64 }
63 65
64 if (priv->sreg_proto_min) { 66 if (priv->sreg_proto_min) {
65 range.min_proto.all = data[priv->sreg_proto_min].data[0]; 67 range.min_proto.all = (__force __be16)
66 range.max_proto.all = data[priv->sreg_proto_max].data[0]; 68 data[priv->sreg_proto_min].data[0];
69 range.max_proto.all = (__force __be16)
70 data[priv->sreg_proto_max].data[0];
67 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED; 71 range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
68 } 72 }
69 73