Skip to content
Commit af253aef authored by Mohammad Shehar Yaar Tausif's avatar Mohammad Shehar Yaar Tausif Committed by Alexei Starovoitov
Browse files

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.

Vlastimil Babka added:

The order of parameters can be traced back all the way to 6ac99e8f
("bpf: Introduce bpf sk local storage") accross several refactorings,
and that's why the commit is used as a Fixes: tag.

In v6.10-rc1, a different commit 2c321f3f ("mm: change inlined
allocation helpers to account at the call site") however exposed the
order of args in a way that gcc-14 has enough visibility to start
warning about it, because (in !CONFIG_MEMCG case) bpf_map_kvcalloc is
then a macro alias for kvcalloc instead of a static inline wrapper.

To sum up the warning happens when the following conditions are all met:

- gcc-14 is used (didn't see it with gcc-13)
- commit 2c321f3f is present
- CONFIG_MEMCG is not enabled in .config
- CONFIG_WERROR turns this from a compiler warning to error

Fixes: 6ac99e8f

 ("bpf: Introduce bpf sk local storage")
Reviewed-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Tested-by: default avatarChristian Kujau <lists@nerdbynature.de>
Signed-off-by: default avatarMohammad Shehar Yaar Tausif <sheharyaar48@gmail.com>
Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
Link: https://lore.kernel.org/r/20240710100521.15061-2-vbabka@suse.cz
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent e1533b63
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment