]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
octeontx2-af: Fix initialization of mcam's entry2target_pffunc field
authorSuman Ghosh <sumang@marvell.com>
Fri, 29 May 2026 11:37:05 +0000 (17:07 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Jun 2026 01:12:02 +0000 (18:12 -0700)
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")
Signed-off-by: Suman Ghosh <sumang@marvell.com>
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/1780054625-17090-1-git-send-email-sbhatta@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

index 607d0cf1a778cd57e82c2f6401f778b4e2d88d79..6bbda0593fcd7550d6ea784486b52034c347d014 100644 (file)
@@ -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;