Skip to content

Commit 2ba436f

Browse files
committed
netfilter: xt_ipcomp: Use ntohs to ease sparse warning
0-DAY kernel build testing backend reported: sparse warnings: (new ones prefixed by >>) >> >> net/netfilter/xt_ipcomp.c:63:26: sparse: restricted __be16 degrades to integer >> >> net/netfilter/xt_ipcomp.c:63:26: sparse: cast to restricted __be32 Fix this by using ntohs without shifting. Tested with: make C=1 CF=-D__CHECK_ENDIAN__ Signed-off-by: Fan Du <fan.du@windriver.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 3d0a062 commit 2ba436f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/netfilter/xt_ipcomp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ static bool comp_mt(const struct sk_buff *skb, struct xt_action_param *par)
6060
}
6161

6262
return spi_match(compinfo->spis[0], compinfo->spis[1],
63-
ntohl(chdr->cpi << 16),
63+
ntohs(chdr->cpi),
6464
!!(compinfo->invflags & XT_IPCOMP_INV_SPI));
6565
}
6666

0 commit comments

Comments
 (0)