From: Ratheesh Kannoth <rkannoth@marvell.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <sgoutham@marvell.com>, <davem@davemloft.net>,
<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
<sbhatta@marvell.com>, <gakula@marvell.com>, <hkelam@marvell.com>,
<bcreeley@amd.com>, <sumang@marvell.com>,
Ratheesh Kannoth <rkannoth@marvell.com>
Subject: [PATCH net v1] octeontx2-af: Initialize bitmap arrays.
Date: Thu, 25 Jan 2024 12:04:14 +0530 [thread overview]
Message-ID: <20240125063414.3930526-1-rkannoth@marvell.com> (raw)
kmalloc_array() without __GFP_ZERO flag does not initializes
memory to zero. This causes issues with bitmap. Use __GFP_ZERO
to fix the issue.
Fixes: dd7842878633 ("octeontx2-af: Add new devlink param to configure maximum usable NIX block LFs")
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
ChangeLogs:
v0 -> v1: Removed devm_kcalloc()._
---
.../ethernet/marvell/octeontx2/af/rvu_npc.c | 20 ++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
index 167145bdcb75..b56def17a2ba 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
@@ -1905,12 +1905,13 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
/* Allocate bitmaps for managing MCAM entries */
mcam->bmap = kmalloc_array(BITS_TO_LONGS(mcam->bmap_entries),
- sizeof(long), GFP_KERNEL);
+ sizeof(long), GFP_KERNEL | __GFP_ZERO);
if (!mcam->bmap)
return -ENOMEM;
mcam->bmap_reverse = kmalloc_array(BITS_TO_LONGS(mcam->bmap_entries),
- sizeof(long), GFP_KERNEL);
+ sizeof(long),
+ GFP_KERNEL | __GFP_ZERO);
if (!mcam->bmap_reverse)
goto free_bmap;
@@ -1918,7 +1919,8 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
/* Alloc memory for saving entry to RVU PFFUNC allocation mapping */
mcam->entry2pfvf_map = kmalloc_array(mcam->bmap_entries,
- sizeof(u16), GFP_KERNEL);
+ sizeof(u16),
+ GFP_KERNEL | __GFP_ZERO);
if (!mcam->entry2pfvf_map)
goto free_bmap_reverse;
@@ -1942,7 +1944,8 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
goto free_entry_map;
mcam->cntr2pfvf_map = kmalloc_array(mcam->counters.max,
- sizeof(u16), GFP_KERNEL);
+ sizeof(u16),
+ GFP_KERNEL | __GFP_ZERO);
if (!mcam->cntr2pfvf_map)
goto free_cntr_bmap;
@@ -1950,18 +1953,21 @@ int npc_mcam_rsrcs_init(struct rvu *rvu, int blkaddr)
* counter's reference count.
*/
mcam->entry2cntr_map = kmalloc_array(mcam->bmap_entries,
- sizeof(u16), GFP_KERNEL);
+ sizeof(u16),
+ GFP_KERNEL | __GFP_ZERO);
if (!mcam->entry2cntr_map)
goto free_cntr_map;
mcam->cntr_refcnt = kmalloc_array(mcam->counters.max,
- sizeof(u16), GFP_KERNEL);
+ sizeof(u16),
+ GFP_KERNEL | __GFP_ZERO);
if (!mcam->cntr_refcnt)
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);
+ sizeof(u16),
+ GFP_KERNEL | __GFP_ZERO);
if (!mcam->entry2target_pffunc)
goto free_cntr_refcnt;
--
2.25.1
next reply other threads:[~2024-01-25 6:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 6:34 Ratheesh Kannoth [this message]
2024-01-25 11:41 ` Simon Horman
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=20240125063414.3930526-1-rkannoth@marvell.com \
--to=rkannoth@marvell.com \
--cc=bcreeley@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gakula@marvell.com \
--cc=hkelam@marvell.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sbhatta@marvell.com \
--cc=sgoutham@marvell.com \
--cc=sumang@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
all inboxes | Powered by JetHome®