Skip to content

Commit

Permalink
bpf: fix order of args in call to bpf_map_kvcalloc
Browse files Browse the repository at this point in the history
The original function call passed size of smap->bucket before the number of
buckets which raises the error 'calloc-transposed-args' on compilation.

Fixes: 62827d6 ("bpf: Remove __bpf_local_storage_map_alloc")
Reviewed-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Mohammad Shehar Yaar Tausif <sheharyaar48@gmail.com>
  • Loading branch information
sheharyaar authored and Kernel Patches Daemon committed Jun 12, 2024
1 parent 07045f6 commit d788703
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/bpf/bpf_local_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,8 +782,8 @@ bpf_local_storage_map_alloc(union bpf_attr *attr,
nbuckets = max_t(u32, 2, nbuckets);
smap->bucket_log = ilog2(nbuckets);

smap->buckets = bpf_map_kvcalloc(&smap->map, sizeof(*smap->buckets),
nbuckets, GFP_USER | __GFP_NOWARN);
smap->buckets = bpf_map_kvcalloc(&smap->map, nbuckets,
sizeof(*smap->buckets), GFP_USER | __GFP_NOWARN);
if (!smap->buckets) {
err = -ENOMEM;
goto free_smap;
Expand Down

0 comments on commit d788703

Please sign in to comment.