netfilter: xt_ipcomp: Use ntohs to ease sparse warning
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 20 Jan 2014 00:55:42 +0000 (01:55 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 19 Feb 2014 10:41:25 +0000 (11:41 +0100)
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>
net/netfilter/xt_ipcomp.c

index a4c7561698c5c2fa5dd9b79717e0cc7116347e54..89d53104c6b365b12c76ff684064bc5d032656c3 100644 (file)
@@ -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));
 }