summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeimin Xiong <xiongwm2026@163.com>2026-07-16 10:51:03 +0800
committerAndrii Nakryiko <andrii@kernel.org>2026-07-27 15:29:31 -0700
commit3c6e8a37eff15c3f834ba80c201932712e4b71d4 (patch)
tree12c0cee4436942c680840f90194fa3ead3f229e4
parent4748a67f711188cbd64bc72c3df636f627858ed0 (diff)
downloadlinux-next-3c6e8a37eff15c3f834ba80c201932712e4b71d4.tar.gz
linux-next-3c6e8a37eff15c3f834ba80c201932712e4b71d4.zip
unix: Use kvmalloc_array() for BPF iterator batches
Use kvmalloc_array() instead of open-coding the element-size multiplication when allocating the Unix-domain BPF iterator batch. Signed-off-by: Weimin Xiong <xiongwm2026@163.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
-rw-r--r--net/unix/af_unix.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f7a9d55eee8a..6664ead46216 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -3659,8 +3659,8 @@ static int bpf_iter_unix_realloc_batch(struct bpf_unix_iter_state *iter,
{
struct sock **new_batch;
- new_batch = kvmalloc(sizeof(*new_batch) * new_batch_sz,
- GFP_USER | __GFP_NOWARN);
+ new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),
+ GFP_USER | __GFP_NOWARN);
if (!new_batch)
return -ENOMEM;