unix: use kvmalloc_array() for BPF iterator batches
Subsystems (3)
PATCH 1/1 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 <[email protected]>
---
net/unix/af_unix.c +2 -2
@@ -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 ;
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 5 lines · On Thu, 16 Jul 2026 10:51:03 +0800 you wrote:
Use
kvmalloc_array()instead of open-coding the element-size multiplication when allocating the Unix-domain BPF iterator batch.Signed-off-by Weimin Xiong <[email protected]>---
Here is the summary with links:
- unix: use kvmalloc_array() for BPF iterator batches
https://git.kernel.org/bpf/bpf-next/c/3c6e8a37eff1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html