netfilter: nf_tables_offload: fix always true policy is unset check
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 16 Sep 2019 16:33:09 +0000 (18:33 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 20 Sep 2019 08:20:02 +0000 (10:20 +0200)
New smatch warnings:
net/netfilter/nf_tables_offload.c:316 nft_flow_offload_chain() warn: always true condition '(policy != -1) => (0-255 != (-1))'

Reported-by: kbuild test robot <lkp@intel.com>
Fixes: c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_offload.c

index 21bb772cb4b707c984d209ef811cd0d86d4d45d9..e546f759b7a714b5376c035e1a82cc1821cb680e 100644 (file)
@@ -313,7 +313,7 @@ static int nft_flow_offload_chain(struct nft_chain *chain,
        policy = ppolicy ? *ppolicy : basechain->policy;
 
        /* Only default policy to accept is supported for now. */
-       if (cmd == FLOW_BLOCK_BIND && policy != -1 && policy != NF_ACCEPT)
+       if (cmd == FLOW_BLOCK_BIND && policy == NF_DROP)
                return -EOPNOTSUPP;
 
        if (dev->netdev_ops->ndo_setup_tc)