Netdev List
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-af: initialize lmac_bmap in rvu_mcs_set_lmac_bmap()
@ 2026-08-12  6:07 Karl Mehltretter
  2026-08-12  6:32 ` Ratheesh Kannoth
  0 siblings, 1 reply; 2+ messages in thread
From: Karl Mehltretter @ 2026-08-12  6:07 UTC (permalink / raw)
  To: Sunil Goutham, Ratheesh Kannoth, Geetha sowjanya,
	Subbaraya Sundeep
  Cc: Karl Mehltretter, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

rvu_mcs_set_lmac_bmap() declares lmac_bmap without initializing it and
only sets bits for valid lmacs with set_bit(), which ORs into the word
without clearing it first. Bits for invalid or skipped ports keep
whatever was on the stack, and the garbage is stored into
mcs->hw->lmac_bmap.

Initialize lmac_bmap to 0 so only valid lmacs are marked.

Found with Clang's -Wconditional-uninitialized.

Fixes: ca7f49ff8846 ("octeontx2-af: cn10k: Introduce driver for macsec block.")
Assisted-by: Claude:claude-fable-5
Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c
index d98b49f47970b..fce22e314cac0 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c
@@ -856,7 +856,7 @@ int rvu_mbox_handler_mcs_ctrl_pkt_rule_write(struct rvu *rvu,
 static void rvu_mcs_set_lmac_bmap(struct rvu *rvu)
 {
 	struct mcs *mcs = mcs_get_pdata(0);
-	unsigned long lmac_bmap;
+	unsigned long lmac_bmap = 0;
 	int cgx, lmac, port;
 
 	for (port = 0; port < mcs->hw->lmac_cnt; port++) {
-- 
2.53.0


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

* Re: [PATCH net] octeontx2-af: initialize lmac_bmap in rvu_mcs_set_lmac_bmap()
  2026-08-12  6:07 [PATCH net] octeontx2-af: initialize lmac_bmap in rvu_mcs_set_lmac_bmap() Karl Mehltretter
@ 2026-08-12  6:32 ` Ratheesh Kannoth
  0 siblings, 0 replies; 2+ messages in thread
From: Ratheesh Kannoth @ 2026-08-12  6:32 UTC (permalink / raw)
  To: Karl Mehltretter
  Cc: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel

On 2026-08-12 at 11:37:30, Karl Mehltretter (kmehltretter@gmail.com) wrote:
> rvu_mcs_set_lmac_bmap() declares lmac_bmap without initializing it and
> only sets bits for valid lmacs with set_bit(), which ORs into the word
> without clearing it first. Bits for invalid or skipped ports keep
> whatever was on the stack, and the garbage is stored into
> mcs->hw->lmac_bmap.
>
> Initialize lmac_bmap to 0 so only valid lmacs are marked.
>
> Found with Clang's -Wconditional-uninitialized.
>
> Fixes: ca7f49ff8846 ("octeontx2-af: cn10k: Introduce driver for macsec block.")
> Assisted-by: Claude:claude-fable-5
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>

Thank you.

Reviewed-by: Ratheesh Kannoth <rkannoth@marvell.com>

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

end of thread, other threads:[~2026-08-12  6:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12  6:07 [PATCH net] octeontx2-af: initialize lmac_bmap in rvu_mcs_set_lmac_bmap() Karl Mehltretter
2026-08-12  6:32 ` Ratheesh Kannoth

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