mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
tcp: Use kvmalloc_array() for BPF iterator batches
Use kvmalloc_array() instead of open-coding the element-size multiplication when allocating the TCP BPF iterator batch. Signed-off-by: Weimin Xiong <xiongwm2026@163.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
parent
3c6e8a37ef
commit
fcf741584a
|
|
@ -2931,8 +2931,8 @@ static int bpf_iter_tcp_realloc_batch(struct bpf_tcp_iter_state *iter,
|
|||
{
|
||||
union bpf_tcp_iter_batch_item *new_batch;
|
||||
|
||||
new_batch = kvmalloc(sizeof(*new_batch) * new_batch_sz,
|
||||
flags | __GFP_NOWARN);
|
||||
new_batch = kvmalloc_array(new_batch_sz, sizeof(*new_batch),
|
||||
flags | __GFP_NOWARN);
|
||||
if (!new_batch)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user