Skip to content

Commit

Permalink
netfilter: xt_ipcomp: Use ntohs to ease sparse warning
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pablo Neira Ayuso committed Feb 19, 2014
1 parent 3d0a062 commit 2ba436f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/xt_ipcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ static bool comp_mt(const struct sk_buff *skb, struct xt_action_param *par)
}

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

Expand Down

0 comments on commit 2ba436f

Please sign in to comment.