netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [bug report] netfilter: nf_tables: add hardware offload support
Date: Wed, 7 Aug 2019 16:36:33 +0300	[thread overview]
Message-ID: <20190807133633.GA22300@mwanda> (raw)

Hello Pablo Neira Ayuso,

The patch c9626a2cbdb2: "netfilter: nf_tables: add hardware offload
support" from Jul 9, 2019, leads to the following static checker
warning:

	net/netfilter/nf_tables_offload.c:196 nft_flow_offload_chain()
	warn: always true condition '(((trans->data)->policy) != -1) => (0-255 != (-1))'

net/netfilter/nf_tables_offload.c
   176  static int nft_flow_offload_chain(struct nft_trans *trans,
   177                                    enum flow_block_command cmd)
   178  {
   179          struct nft_chain *chain = trans->ctx.chain;
   180          struct netlink_ext_ack extack = {};
   181          struct flow_block_offload bo = {};
   182          struct nft_base_chain *basechain;
   183          struct net_device *dev;
   184          int err;
   185  
   186          if (!nft_is_base_chain(chain))
   187                  return -EOPNOTSUPP;
   188  
   189          basechain = nft_base_chain(chain);
   190          dev = basechain->ops.dev;
   191          if (!dev || !dev->netdev_ops->ndo_setup_tc)
   192                  return -EOPNOTSUPP;
   193  
   194          /* Only default policy to accept is supported for now. */
   195          if (cmd == FLOW_BLOCK_BIND &&
   196              nft_trans_chain_policy(trans) != -1 &&
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
nft_trans_chain_policy() is a u8 so it can't be -1.

   197              nft_trans_chain_policy(trans) != NF_ACCEPT)
   198                  return -EOPNOTSUPP;
   199  
   200          bo.command = cmd;
   201          bo.block = &basechain->flow_block;
   202          bo.binder_type = FLOW_BLOCK_BINDER_TYPE_CLSACT_INGRESS;
   203          bo.extack = &extack;
   204          INIT_LIST_HEAD(&bo.cb_list);

regards,
dan carpenter

                 reply	other threads:[~2019-08-07 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190807133633.GA22300@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).