All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hkalra@marvell.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] octeontx2-af: support for coalescing KPU profiles
Date: Tue, 12 Jul 2022 13:53:09 +0300	[thread overview]
Message-ID: <Ys1SlWMAiUBV6gGC@kili> (raw)

Hello Harman Kalra,

This is a semi-automatic email about new static checker warnings.

The patch 11c730bfbf5b: "octeontx2-af: support for coalescing KPU 
profiles" from May 27, 2021, leads to the following Smatch complaint:

    drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c:1624 npc_load_kpu_profile_fwdb()
    warn: variable dereferenced before check 'rvu->kpu_prfl_addr' (see line 1619)

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
  1608  static int npc_load_kpu_profile_fwdb(struct rvu *rvu, const char *kpu_profile)
  1609  {
  1610          int ret = -EINVAL;
  1611          u64 prfl_sz;
  1612  
  1613          /* Setting up the mapping for NPC profile image */
  1614          ret = npc_fwdb_prfl_img_map(rvu, &rvu->kpu_prfl_addr, &prfl_sz);
  1615          if (ret < 0)
  1616                  goto done;
  1617  
  1618          /* Detect if profile is coalesced or single KPU profile and load */
  1619          ret = npc_fwdb_detect_load_prfl_img(rvu, prfl_sz, kpu_profile);

rvu->kpu_prfl_addr dereferenced inside function call

  1620          if (ret == 0)
  1621                  goto done;
  1622  
  1623          /* Cleaning up if KPU profile image from fwdata is not valid. */
  1624          if (rvu->kpu_prfl_addr) {
                    ^^^^^^^^^^^^^^^^^^
Smatch isn't supposed to warn about places where the NULL check is
*obviously* not required but I think I messed up something.  Anyway,
this NULL check doesn't make sense.

  1625                  iounmap(rvu->kpu_prfl_addr);
  1626                  rvu->kpu_prfl_addr = NULL;
  1627                  rvu->kpu_fwdata_sz = 0;
  1628                  rvu->kpu_fwdata = NULL;
  1629          }
  1630  
  1631  done:
  1632          return ret;
  1633  }

regards,
dan carpenter

                 reply	other threads:[~2022-07-12 10:53 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=Ys1SlWMAiUBV6gGC@kili \
    --to=dan.carpenter@oracle.com \
    --cc=hkalra@marvell.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.