Re: [PATCH v1] nfp: bpf: Use kmemdup_array instead of kmemdup for multiple allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx. 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@xxxxxxxx>
> ---
>  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@xxxxxxxxxxxx>




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux