netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ntp: fix size argument for kcalloc
@ 2024-07-03  2:56 Chen Ni
  2024-07-03  9:16 ` Przemek Kitszel
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Chen Ni @ 2024-07-03  2:56 UTC (permalink / raw)
  To: louis.peens, kuba, davem, edumazet, pabeni, horms, yinjun.zhang,
	johannes.berg, ryno.swart, ziyang.chen, linma, niklas.soderlund
  Cc: oss-drivers, netdev, linux-kernel, Chen Ni

The size argument to kcalloc should be the size of desired structure,
not the pointer to it.

Fixes: 6402528b7a0b ("nfp: xsk: add AF_XDP zero-copy Rx and Tx support")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 182ba0a8b095..768f22cd3d02 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2539,7 +2539,7 @@ nfp_net_alloc(struct pci_dev *pdev, const struct nfp_dev_info *dev_info,
 				  nn->dp.num_r_vecs, num_online_cpus());
 	nn->max_r_vecs = nn->dp.num_r_vecs;
 
-	nn->dp.xsk_pools = kcalloc(nn->max_r_vecs, sizeof(nn->dp.xsk_pools),
+	nn->dp.xsk_pools = kcalloc(nn->max_r_vecs, sizeof(*nn->dp.xsk_pools),
 				   GFP_KERNEL);
 	if (!nn->dp.xsk_pools) {
 		err = -ENOMEM;
-- 
2.25.1


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

end of thread, other threads:[~2024-07-04 14:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03  2:56 [PATCH net-next] ntp: fix size argument for kcalloc Chen Ni
2024-07-03  9:16 ` Przemek Kitszel
2024-07-04  9:36   ` Paolo Abeni
2024-07-04  9:41     ` Paolo Abeni
2024-07-04 10:17       ` Przemek Kitszel
2024-07-04 14:21         ` Jakub Kicinski
2024-07-04  5:36 ` Louis Peens
2024-07-04  7:30 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).