All of lore.kernel.org
 help / color / mirror / Atom feed
From: Louis Peens <louis.peens@corigine.com>
To: Yu Jiaoliang <yujiaoliang@vivo.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	bpf@vger.kernel.org, oss-drivers@corigine.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	opensource.kernel@vivo.com
Subject: Re: [PATCH v1] nfp: bpf: Use kmemdup_array instead of kmemdup for multiple allocation
Date: Wed, 21 Aug 2024 11:49:51 +0200	[thread overview]
Message-ID: <ZsW4P-4c4dNSFBBP@LouisNoVo> (raw)
In-Reply-To: <20240821081447.12430-1-yujiaoliang@vivo.com>

On Wed, Aug 21, 2024 at 04:14:45PM +0800, Yu Jiaoliang wrote:
> [Some people who received this message don't often get email from yujiaoliang@vivo.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> Let the kememdup_array() take care about multiplication and possible
> overflows.
> 
> Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com>
> ---
>  drivers/net/ethernet/netronome/nfp/bpf/jit.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/netronome/nfp/bpf/jit.c b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
> index df2ab5cbd49b..3a02eef58cc6 100644
> --- a/drivers/net/ethernet/netronome/nfp/bpf/jit.c
> +++ b/drivers/net/ethernet/netronome/nfp/bpf/jit.c
> @@ -4537,8 +4537,8 @@ void *nfp_bpf_relo_for_vnic(struct nfp_prog *nfp_prog, struct nfp_bpf_vnic *bv)
>         u64 *prog;
>         int err;
> 
> -       prog = kmemdup(nfp_prog->prog, nfp_prog->prog_len * sizeof(u64),
> -                      GFP_KERNEL);
> +       prog = kmemdup_array(nfp_prog->prog, nfp_prog->prog_len, sizeof(u64),
> +                            GFP_KERNEL);
>         if (!prog)
>                 return ERR_PTR(-ENOMEM);
> 
> --
Hi, thanks for the cleanup, looks good to me.

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

  reply	other threads:[~2024-08-21  9:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-21  8:14 [PATCH v1] nfp: bpf: Use kmemdup_array instead of kmemdup for multiple allocation Yu Jiaoliang
2024-08-21  9:49 ` Louis Peens [this message]
2024-08-21 15:08 ` Simon Horman
2024-08-22 13:20 ` patchwork-bot+netdevbpf

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=ZsW4P-4c4dNSFBBP@LouisNoVo \
    --to=louis.peens@corigine.com \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    --cc=yujiaoliang@vivo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.