All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] octeontx2-pf: Add support for ethtool ntuple filters
Date: Thu, 26 Nov 2020 12:33:34 +0000	[thread overview]
Message-ID: <20201126123334.GA205581@mwanda> (raw)

Hello Subbaraya Sundeep,

The patch f0a1913f8a6f: "octeontx2-pf: Add support for ethtool ntuple
filters" from Nov 15, 2020, leads to the following static checker
warning:

	drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c:51 otx2_alloc_mcam_entries()
	error: 'rsp' dereferencing possible ERR_PTR()

drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
    22  int otx2_alloc_mcam_entries(struct otx2_nic *pfvf)
    23  {
    24          struct otx2_flow_config *flow_cfg = pfvf->flow_cfg;
    25          struct npc_mcam_alloc_entry_req *req;
    26          struct npc_mcam_alloc_entry_rsp *rsp;
    27          int vf_vlan_max_flows;
    28          int i;
    29  
    30          mutex_lock(&pfvf->mbox.lock);
    31  
    32          req = otx2_mbox_alloc_msg_npc_mcam_alloc_entry(&pfvf->mbox);
    33          if (!req) {
    34                  mutex_unlock(&pfvf->mbox.lock);
    35                  return -ENOMEM;
    36          }
    37  
    38          vf_vlan_max_flows = pfvf->total_vfs * OTX2_PER_VF_VLAN_FLOWS;
    39          req->contig = false;
    40          req->count = OTX2_MCAM_COUNT + vf_vlan_max_flows;
    41  
    42          /* Send message to AF */
    43          if (otx2_sync_mbox_msg(&pfvf->mbox)) {
    44                  mutex_unlock(&pfvf->mbox.lock);
    45                  return -EINVAL;
    46          }
    47  
    48          rsp = (struct npc_mcam_alloc_entry_rsp *)otx2_mbox_get_rsp
    49                 (&pfvf->mbox.mbox, 0, &req->hdr);

The otx2_mbox_get_rsp() function can fail, but this code doesn't check
for errors.

    50  
    51          if (rsp->count != req->count) {
    52                  netdev_info(pfvf->netdev,
    53                              "Unable to allocate %d MCAM entries, got %d\n",
    54                              req->count, rsp->count);
    55                  /* support only ntuples here */
    56                  flow_cfg->ntuple_max_flows = rsp->count;
    57                  flow_cfg->ntuple_offset = 0;

regards,
dan carpenter

                 reply	other threads:[~2020-11-26 12:33 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=20201126123334.GA205581@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.