We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents cd0beac + b6ab509 commit 1696704Copy full SHA for 1696704
net/core/filter.c
@@ -1265,8 +1265,8 @@ static struct bpf_prog *bpf_migrate_filter(struct bpf_prog *fp)
1265
* so we need to keep the user BPF around until the 2nd
1266
* pass. At this time, the user BPF is stored in fp->insns.
1267
*/
1268
- old_prog = kmemdup(fp->insns, old_len * sizeof(struct sock_filter),
1269
- GFP_KERNEL | __GFP_NOWARN);
+ old_prog = kmemdup_array(fp->insns, old_len, sizeof(struct sock_filter),
+ GFP_KERNEL | __GFP_NOWARN);
1270
if (!old_prog) {
1271
err = -ENOMEM;
1272
goto out_err;
0 commit comments