Skip to content

Commit

Permalink
netfilter: nft_redir: fix sparse warnings
Browse files Browse the repository at this point in the history
>> net/netfilter/nft_redir.c:39:26: sparse: incorrect type in assignment (different base types)
   net/netfilter/nft_redir.c:39:26:    expected unsigned int [unsigned] [usertype] nla_be32
   net/netfilter/nft_redir.c:39:26:    got restricted __be32
>> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:40:40: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:46:34: sparse: incorrect type in assignment (different base types)
   net/netfilter/nft_redir.c:46:34:    expected unsigned int [unsigned] [usertype] nla_be32
   net/netfilter/nft_redir.c:46:34:    got restricted __be32
>> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32
>> net/netfilter/nft_redir.c:47:48: sparse: cast to restricted __be32

Fixes: e9105f1 ("netfilter: nf_tables: add new expression nft_redir")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Pablo Neira Ayuso committed Nov 12, 2014
1 parent f6c6339 commit baf4750
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions net/netfilter/nft_redir.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,24 @@ int nft_redir_init(const struct nft_ctx *ctx,
const struct nlattr * const tb[])
{
struct nft_redir *priv = nft_expr_priv(expr);
u32 nla_be32;
int err;

err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT);
if (err < 0)
return err;

if (tb[NFTA_REDIR_REG_PROTO_MIN]) {
nla_be32 = nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MIN]);
priv->sreg_proto_min = ntohl(nla_be32);
priv->sreg_proto_min =
ntohl(nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MIN]));

err = nft_validate_input_register(priv->sreg_proto_min);
if (err < 0)
return err;

if (tb[NFTA_REDIR_REG_PROTO_MAX]) {
nla_be32 = nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MAX]);
priv->sreg_proto_max = ntohl(nla_be32);
priv->sreg_proto_max =
ntohl(nla_get_be32(tb[NFTA_REDIR_REG_PROTO_MAX]));

err = nft_validate_input_register(priv->sreg_proto_max);
if (err < 0)
return err;
Expand Down

0 comments on commit baf4750

Please sign in to comment.