From: Mohammad Shehar Yaar Tausif Date: Thu, 16 May 2024 07:24:11 +0000 (+0530) Subject: bpf: Fix order of args in call to bpf_map_kvcalloc X-Git-Tag: v6.11-rc1~163^2~304^2~17 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f130e4d4a5f7174f98300376f3994817ad7e21c;p=thirdparty%2Fkernel%2Flinux.git bpf: Fix order of args in call to bpf_map_kvcalloc The original function call passed size of smap->bucket before the number of buckets which raises the error 'calloc-transposed-args' on compilation. Signed-off-by: Mohammad Shehar Yaar Tausif Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20240516072411.42016-1-sheharyaar48@gmail.com Signed-off-by: Alexei Starovoitov --- diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c index 976cb258a0edb..c938dea5ddbf3 100644 --- a/kernel/bpf/bpf_local_storage.c +++ b/kernel/bpf/bpf_local_storage.c @@ -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;