Skip to contentSkip to conversation

octeontx2-af: Fix initialization of mcam's entry2target_pffunc field

PATCH Applied Subbaraya Sundeep 3 participants 3 messages May 29 – Jun 4

Subsystems (3)
lore
Share & tools
lore

Subbaraya Sundeep

author maintainer
#0 lore raw

PATCH 1/1 octeontx2-af: Fix initialization of mcam's entry2target_pffunc field

From: Suman Ghosh <[email protected]>

NPC mcam entry stores a mapping between mcam entry and target pcifunc. During initialization of this field, API kmalloc_array has been used which caused some junk values to array. Whereas, the array is expected to be initialized by 0. This patch fixes the same by using kcalloc instead of kmalloc_array.

Fixes 55307fcb9258 ("octeontx2-af: Add mbox messages to install and delete MCAM rules")
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +2 -2
index 607d0cf1a778..6bbda0593fcd 100644
@@ -2192,8 +2192,8 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
 		goto free_entry_cntr_map;
 
 	/* Alloc memory for saving target device of mcam rule */
-	mcam->entry2target_pffunc = kmalloc_array(mcam->total_entries,
-						  sizeof(u16), GFP_KERNEL);
+	mcam->entry2target_pffunc = kcalloc(mcam->total_entries,
+					    sizeof(u16), GFP_KERNEL);
 	if (!mcam->entry2target_pffunc)
 		goto free_cntr_refcnt;
 
Signature · 1 line
2.48.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Subbaraya Sundeep

From: Suman Ghosh <[email protected]>

NPC mcam entry stores a mapping between mcam entry and target pcifunc. During initialization of this field, API kmalloc_array has been used which caused some junk values to array. Whereas, the array is expected to be initialized by 0. This patch fixes the same by using kcalloc instead of kmalloc_array.

Fixes 55307fcb9258 ("octeontx2-af: Add mbox messages to install and delete MCAM rules")

FTR, there is an AI-generated review of this patch available on sashiko.dev. However, I believe that the issue raised there can be treated in the context of possible follow-up and should not delay the progress of this patch.

#2 lore raw
In reply to Subbaraya Sundeep
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Fri, 29 May 2026 17:07:05 +0530 you wrote:

From: Suman Ghosh <[email protected]>

NPC mcam entry stores a mapping between mcam entry and target pcifunc. During initialization of this field, API kmalloc_array has been used which caused some junk values to array. Whereas, the array is expected to be initialized by 0. This patch fixes the same by using kcalloc instead of kmalloc_array.

[...]

Here is the summary with links:
- [net] octeontx2-af: Fix initialization of mcam's entry2target_pffunc field

    https://git.kernel.org/netdev/net/c/9a85ec3dc28b

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html