netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com
Subject: [PATCH net-next 1/6] netfilter: nft_payload: use __be16 to store gre version
Date: Mon, 14 Nov 2022 11:41:01 +0100	[thread overview]
Message-ID: <20221114104106.8719-2-pablo@netfilter.org> (raw)
In-Reply-To: <20221114104106.8719-1-pablo@netfilter.org>

GRE_VERSION and GRE_VERSION0 are expressed in network byte order,
use __be16. Uncovered by sparse:

net/netfilter/nft_payload.c:112:25: warning: incorrect type in assignment (different base types)
net/netfilter/nft_payload.c:112:25:    expected unsigned int [usertype] version
net/netfilter/nft_payload.c:112:25:    got restricted __be16
net/netfilter/nft_payload.c:114:22: warning: restricted __be16 degrades to integer

Fixes: c247897d7c19 ("netfilter: nft_payload: access GRE payload via inner offset")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_payload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
index 9d2ac764a14c..53e64d8aa01f 100644
--- a/net/netfilter/nft_payload.c
+++ b/net/netfilter/nft_payload.c
@@ -102,8 +102,9 @@ static int __nft_payload_inner_offset(struct nft_pktinfo *pkt)
 		}
 		break;
 	case IPPROTO_GRE: {
-		u32 offset = sizeof(struct gre_base_hdr), version;
+		u32 offset = sizeof(struct gre_base_hdr);
 		struct gre_base_hdr *gre, _gre;
+		__be16 version;
 
 		gre = skb_header_pointer(pkt->skb, thoff, sizeof(_gre), &_gre);
 		if (!gre)
-- 
2.30.2


  reply	other threads:[~2022-11-14 10:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 10:41 [PATCH net-next 0/6] Netfilter updates for net-next Pablo Neira Ayuso
2022-11-14 10:41 ` Pablo Neira Ayuso [this message]
2022-11-14 10:41 ` [PATCH net-next 2/6] netfilter: nft_inner: fix return value check in nft_inner_parse_l2l3() Pablo Neira Ayuso
2022-11-14 10:41 ` [PATCH net-next 3/6] netfilter: nf_tables: Extend nft_expr_ops::dump callback parameters Pablo Neira Ayuso
2022-11-15  3:04   ` Jakub Kicinski
2022-11-15  9:40     ` Pablo Neira Ayuso
2022-11-14 10:41 ` [PATCH net-next 4/6] netfilter: nf_tables: Introduce NFT_MSG_GETRULE_RESET Pablo Neira Ayuso
2022-11-14 10:41 ` [PATCH net-next 5/6] netfilter: rpfilter/fib: clean up some inconsistent indenting Pablo Neira Ayuso
2022-11-14 10:41 ` [PATCH net-next 6/6] netfilter: conntrack: use siphash_4u64 Pablo Neira Ayuso
2022-11-15  3:02   ` Jakub Kicinski
  -- strict thread matches above, loose matches on Subject: below --
2022-11-15  9:59 [PATCH net-next,v2 0/6] Netfilter updates for net-next Pablo Neira Ayuso
2022-11-15  9:59 ` [PATCH net-next 1/6] netfilter: nft_payload: use __be16 to store gre version Pablo Neira Ayuso
2022-11-16  5:00   ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221114104106.8719-2-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).