aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2022-06-23 15:05:09 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2022-07-11 16:40:45 +0200
commitec6f2ff0a3985907b0c224e482d790615be5772d (patch)
tree867769fb39affddde4cfb35f38518e8bb430b89e
parentnetfilter: nft_set_bitmap: Fix spelling mistake (diff)
downloadlinux-dev-ec6f2ff0a3985907b0c224e482d790615be5772d.tar.xz
linux-dev-ec6f2ff0a3985907b0c224e482d790615be5772d.zip
netfilter: nfnetlink: add missing __be16 cast
Sparse flags this as suspicious, because this compares integer with a be16 with no conversion. Its a compat check for old userspace that sends host byte order, so force a be16 cast here. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/nfnetlink.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 2f7c477fc9e7..c24b1240908f 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -626,7 +626,7 @@ static void nfnetlink_rcv_skb_batch(struct sk_buff *skb, struct nlmsghdr *nlh)
nfgenmsg = nlmsg_data(nlh);
skb_pull(skb, msglen);
/* Work around old nft using host byte order */
- if (nfgenmsg->res_id == NFNL_SUBSYS_NFTABLES)
+ if (nfgenmsg->res_id == (__force __be16)NFNL_SUBSYS_NFTABLES)
res_id = NFNL_SUBSYS_NFTABLES;
else
res_id = ntohs(nfgenmsg->res_id);