diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-10-28 11:05:57 +0300 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2022-11-01 14:11:00 +0300 |
commit | 66394126bf2045d25b70c9327a6372186bba7d66 (patch) | |
tree | bdd040c1360dd55926df1c9147f53454aa4f549b /net | |
parent | 6f1a298b2e24c703bfcc643e41bc7c0604fe4830 (diff) | |
download | linux-66394126bf2045d25b70c9327a6372186bba7d66.tar.xz |
netfilter: nft_payload: use __be16 to store gre version
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nft_payload.c | 3 |
1 files changed, 2 insertions, 1 deletions
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) |