netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Louis Peens <louis.peens@corigine.com>
To: Chen Ni <nichen@iscas.ac.cn>
Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, horms@kernel.org, yinjun.zhang@corigine.com,
	johannes.berg@intel.com, ryno.swart@corigine.com,
	ziyang.chen@corigine.com, linma@zju.edu.cn,
	niklas.soderlund@corigine.com, oss-drivers@corigine.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] ntp: fix size argument for kcalloc
Date: Thu, 4 Jul 2024 07:36:24 +0200	[thread overview]
Message-ID: <ZoY02KXZ3GyS7nXg@LouisNoVo> (raw)
In-Reply-To: <20240703025625.1695052-1-nichen@iscas.ac.cn>

Wed, Jul 03, 2024 at 10:56:25AM +0800, Chen Ni wrote:
> 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;
> -- 
Looks good to me, thanks.

Signed-off-by: Louis Peens <louis.peens@corigine.com>

  parent reply	other threads:[~2024-07-04  5:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2024-07-04  7:30 ` 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=ZoY02KXZ3GyS7nXg@LouisNoVo \
    --to=louis.peens@corigine.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linma@zju.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nichen@iscas.ac.cn \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    --cc=ryno.swart@corigine.com \
    --cc=yinjun.zhang@corigine.com \
    --cc=ziyang.chen@corigine.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;
as well as URLs for NNTP newsgroup(s).