All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] octeontx2-af: support for coalescing KPU profiles
@ 2022-07-12 10:53 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-07-12 10:53 UTC (permalink / raw)
  To: hkalra; +Cc: kernel-janitors

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-12 10:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-12 10:53 [bug report] octeontx2-af: support for coalescing KPU profiles Dan Carpenter

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.