summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Jiaoliang <yujiaoliang@vivo.com>2024-08-21 10:14:45 +0200
committerPaolo Abeni <pabeni@redhat.com>2024-08-22 15:12:02 +0200
commitd6f75d86aa786740ef7a7607685e9e1039e30aab (patch)
tree642afa4be88deaa9ac28832ea34c65e6182db02f
parentnet: airoha: configure hw mac address according to the port id (diff)
downloadlinux-d6f75d86aa786740ef7a7607685e9e1039e30aab.tar.xz
linux-d6f75d86aa786740ef7a7607685e9e1039e30aab.zip
nfp: bpf: Use kmemdup_array instead of kmemdup for multiple allocation
Let the kememdup_array() take care about multiplication and possible overflows. Signed-off-by: Yu Jiaoliang <yujiaoliang@vivo.com> Signed-off-by: Louis Peens <louis.peens@corigine.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20240821081447.12430-1-yujiaoliang@vivo.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r--drivers/net/ethernet/netronome/nfp/bpf/jit.c4
1 files 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);