Thread (2 messages) read the whole thread 2 messages, 2 authors, 17d ago

Re: [PATCH net] octeontx2: Fix Klocwork issues in AF and PF drivers

From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Date: 2026-07-14 15:50:49
Also in: lkml

On 14.07.2026 03:02, Ratheesh Kannoth wrote:
quoted hunk ↗ jump to hunk
From: Suman Ghosh <redacted>

Fix null dereference, uninitialized variable, and error-path resource
leak findings reported by Klocwork across the OcteonTX2 AF and PF code.

Fixes: 818ed8933bd1 ("octeontx2-af: Re-enable MAC TX in otx2_stop processing")
Cc: Naveen Mamindlapalli <redacted>
Signed-off-by: Suman Ghosh <redacted>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
  drivers/net/ethernet/marvell/octeontx2/af/cgx.c      | 12 +++++++++---
  .../net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c   |  8 +++++---
  drivers/net/ethernet/marvell/octeontx2/af/npc.h      |  6 +++---
  drivers/net/ethernet/marvell/octeontx2/af/ptp.c      | 11 ++++++++++-
  drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c  |  2 +-
  drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c  |  2 +-
  .../net/ethernet/marvell/octeontx2/af/rvu_debugfs.c  |  8 +++++++-
  drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c  |  2 +-
  drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c  |  2 +-
  .../net/ethernet/marvell/octeontx2/nic/otx2_flows.c  |  1 +
  drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c |  3 +++
  drivers/net/ethernet/marvell/octeontx2/nic/qos.c     |  1 +
  12 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
index 2e94d5105016..70c8ef5f0be0 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
@@ -491,12 +491,19 @@ int cgx_lmac_addr_max_entries_get(u8 cgx_id, u8 lmac_id)
  u64 cgx_lmac_addr_get(u8 cgx_id, u8 lmac_id)
  {
  	struct cgx *cgx_dev = cgx_get_pdata(cgx_id);
-	struct lmac *lmac = lmac_pdata(lmac_id, cgx_dev);
  	struct mac_ops *mac_ops;
+	struct lmac *lmac;
  	int index;
  	u64 cfg;
  	int id;
  
+	if (!cgx_dev)
+		return 0;
+
+	lmac = lmac_pdata(lmac_id, cgx_dev);
+	if (!lmac)
+		return 0;
+
this 2 checks are added for impossible cases. both values are checked for
existence in a signle caller of cgx_lmac_addr_get(). Please, do not add
defensive code for no reason. I didn't check other changes, but I believe they
are of the same quality coming from yet-anothener-anaylizing tool.

Please, provide stack traces if these checks are really needed.

[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help