Message ID | 20240821081447.12430-1-yujiaoliang@vivo.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d6f75d86aa786740ef7a7607685e9e1039e30aab |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [v1] nfp: bpf: Use kmemdup_array instead of kmemdup for multiple allocation | expand |
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>
On Wed, Aug 21, 2024 at 04:14:45PM +0800, Yu Jiaoliang wrote: > Let the kememdup_array() take care about multiplication and possible > overflows. > > Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com> Reviewed-by: Simon Horman <horms@kernel.org>
Hello: This patch was applied to netdev/net-next.git (main) by Paolo Abeni <pabeni@redhat.com>: On Wed, 21 Aug 2024 16:14:45 +0800 you wrote: > 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(-) Here is the summary with links: - [v1] nfp: bpf: Use kmemdup_array instead of kmemdup for multiple allocation https://git.kernel.org/netdev/net-next/c/d6f75d86aa78 You are awesome, thank you!
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);
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(-)