netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nftables-kernel PATCH v2] netfilter: nftables: Fix sparse endianness issue on nft_nat.c
@ 2013-10-28 10:19 Tomasz Bursztyka
  2013-10-28 16:46 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Tomasz Bursztyka @ 2013-10-28 10:19 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Tomasz Bursztyka

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>
---
 net/netfilter/nft_nat.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c
index b0b87b2..d3b1ffe 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,
 	memset(&range, 0, sizeof(range));
 	if (priv->sreg_addr_min) {
 		if (priv->family == AF_INET) {
-			range.min_addr.ip = data[priv->sreg_addr_min].data[0];
-			range.max_addr.ip = data[priv->sreg_addr_max].data[0];
+			range.min_addr.ip = (__force __be32)
+					data[priv->sreg_addr_min].data[0];
+			range.max_addr.ip = (__force __be32)
+					data[priv->sreg_addr_max].data[0];
 
 		} else {
 			memcpy(range.min_addr.ip6,
@@ -62,8 +64,10 @@ static void nft_nat_eval(const struct nft_expr *expr,
 	}
 
 	if (priv->sreg_proto_min) {
-		range.min_proto.all = data[priv->sreg_proto_min].data[0];
-		range.max_proto.all = data[priv->sreg_proto_max].data[0];
+		range.min_proto.all = (__force __be16)
+					data[priv->sreg_proto_min].data[0];
+		range.max_proto.all = (__force __be16)
+					data[priv->sreg_proto_max].data[0];
 		range.flags |= NF_NAT_RANGE_PROTO_SPECIFIED;
 	}
 
-- 
1.8.3.2


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

* Re: [nftables-kernel PATCH v2] netfilter: nftables: Fix sparse endianness issue on nft_nat.c
  2013-10-28 10:19 [nftables-kernel PATCH v2] netfilter: nftables: Fix sparse endianness issue on nft_nat.c Tomasz Bursztyka
@ 2013-10-28 16:46 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2013-10-28 16:46 UTC (permalink / raw)
  To: Tomasz Bursztyka; +Cc: netfilter-devel

On Mon, Oct 28, 2013 at 12:19:45PM +0200, Tomasz Bursztyka wrote:
> 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>

Applied, thanks.

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

end of thread, other threads:[~2013-10-28 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-28 10:19 [nftables-kernel PATCH v2] netfilter: nftables: Fix sparse endianness issue on nft_nat.c Tomasz Bursztyka
2013-10-28 16:46 ` Pablo Neira Ayuso

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).