mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-af: guard is_pf_cgxmapped() when PF to CGX map is absent
@ 2026-09-15  2:29 Ratheesh Kannoth
  2026-09-18  5:30 ` netdev-bot+sashiko
  0 siblings, 1 reply; 4+ messages in thread
From: Ratheesh Kannoth @ 2026-09-15  2:29 UTC (permalink / raw)
  To: davem, gakula, lcherian, linux-kernel, netdev, sgoutham
  Cc: andrew+netdev, edumazet, kuba, pabeni, Sai Krishna, Ratheesh Kannoth

From: Sai Krishna <saikrishnag@marvell.com>

pf2cgxlmac_map is allocated during CGX init to map RVU PFs to CGX
LMACs. When the bootloader does not provide RPM/firmware data, CGX
devices may be absent and the map is never allocated, leaving the
pointer NULL.

Several call paths use is_pf_cgxmapped() before indexing
pf2cgxlmac_map[], but the helper did not verify that the map exists.
Return false when pf2cgxlmac_map is NULL to avoid dereferencing it
in RPM-less configurations.

Fixes: 3a4fa841b039 ("octeontx2-af: Set RVU PFs to CGX LMACs mapping")
Signed-off-by: Sai Krishna <saikrishnag@marvell.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
index 094227404ef9..1e0a5aeb3f57 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
@@ -970,6 +970,9 @@ static inline int rvu_get_pf(struct pci_dev *pdev, u16 pcifunc)
 /* CGX APIs */
 static inline bool is_pf_cgxmapped(struct rvu *rvu, u8 pf)
 {
+	if (!rvu->pf2cgxlmac_map)
+		return false;
+
 	return (pf >= PF_CGXMAP_BASE && pf <= rvu->cgx_mapped_pfs) &&
 		!is_sdp_pf(rvu, rvu_make_pcifunc(rvu->pdev, pf, 0));
 }
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-21 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15  2:29 [PATCH net] octeontx2-af: guard is_pf_cgxmapped() when PF to CGX map is absent Ratheesh Kannoth
2026-09-18  5:30 ` netdev-bot+sashiko
2026-09-18  5:55   ` Ratheesh Kannoth
2026-09-21 22:01     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®