Skip to content

Commit ec6f2ff

Browse files
Florian Westphalummakynes
authored andcommitted
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>
1 parent f725474 commit ec6f2ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nfnetlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ static void nfnetlink_rcv_skb_batch(struct sk_buff *skb, struct nlmsghdr *nlh)
626626
nfgenmsg = nlmsg_data(nlh);
627627
skb_pull(skb, msglen);
628628
/* Work around old nft using host byte order */
629-
if (nfgenmsg->res_id == NFNL_SUBSYS_NFTABLES)
629+
if (nfgenmsg->res_id == (__force __be16)NFNL_SUBSYS_NFTABLES)
630630
res_id = NFNL_SUBSYS_NFTABLES;
631631
else
632632
res_id = ntohs(nfgenmsg->res_id);

0 commit comments

Comments
 (0)