Netdev List
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <davem@davemloft.net>, <gakula@marvell.com>,
	<lcherian@marvell.com>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>, <sgoutham@marvell.com>
Cc: <andrew+netdev@lunn.ch>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, Sai Krishna <saikrishnag@marvell.com>,
	Ratheesh Kannoth <rkannoth@marvell.com>
Subject: [PATCH net] octeontx2-af: guard is_pf_cgxmapped() when PF to CGX map is absent
Date: Tue, 15 Sep 2026 07:59:52 +0530	[thread overview]
Message-ID: <20260915022952.886639-1-rkannoth@marvell.com> (raw)

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


             reply	other threads:[~2026-09-15  2:30 UTC|newest]

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

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=20260915022952.886639-1-rkannoth@marvell.com \
    --to=rkannoth@marvell.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saikrishnag@marvell.com \
    --cc=sgoutham@marvell.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox