linux/tools/bpf/bpftool
Tiezhu Yang e0d29c4def bpftool: Silence build warning about calloc()
[ Upstream commit f5f30386c7 ]

There exists the following warning when building bpftool:

  CC      prog.o
prog.c: In function ‘profile_open_perf_events’:
prog.c:2301:24: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args]
 2301 |                 sizeof(int), obj->rodata->num_cpu * obj->rodata->num_metric);
      |                        ^~~
prog.c:2301:24: note: earlier argument should specify number of elements, later size of each element

Tested with the latest upstream GCC which contains a new warning option
-Wcalloc-transposed-args. The first argument to calloc is documented to
be number of elements in array, while the second argument is size of each
element, just switch the first and second arguments of calloc() to silence
the build warning, compile tested only.

Fixes: 47c09d6a9f ("bpftool: Introduce "prog profile" command")
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20240116061920.31172-1-yangtiezhu@loongson.cn
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-03-26 18:21:17 -04:00
..
bash-completion tools: bpftool: Complete metrics list in "bpftool prog profile" doc 2021-07-30 15:40:28 -07:00
Documentation bpftool: Fix indent in option lists in the documentation 2022-01-27 11:05:26 +01:00
skeleton bpftool: Use a local bpf_perf_event_value to fix accessing its fields 2023-09-19 12:22:32 +02:00
.gitignore tools/bpf: Remove bpf-helpers from bpftool docs 2021-03-04 18:39:45 -08:00
btf.c tools: bpftool: Document and add bash completion for -L, -B options 2021-07-30 15:40:28 -07:00
btf_dumper.c bpftool: Fix a wrong type cast in btf_dumper_int 2022-10-26 12:34:39 +02:00
cfg.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
cfg.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00
cgroup.c tools: bpftool: Document and add bash completion for -L, -B options 2021-07-30 15:40:28 -07:00
common.c bpftool: Fix NULL pointer dereference when pin {PROG, MAP, LINK} without FILE 2022-11-16 09:58:15 +01:00
feature.c bpftool: JIT limited misreported as negative value on aarch64 2023-07-23 13:46:50 +02:00
gen.c bpftool: Only set obj->skeleton on complete success 2022-04-08 14:23:24 +02:00
iter.c tools: bpftool: Update and synchronise option list in doc and help msg 2021-07-30 15:40:27 -07:00
jit_disasm.c tools bpftool: Fix compilation error with new binutils 2023-03-17 08:49:04 +01:00
json_writer.c tools: bpftool: Remove invalid \' json escape 2023-05-11 23:00:25 +09:00
json_writer.h bpftool: Support dumping metadata 2020-09-15 18:28:27 -07:00
link.c tools: bpftool: Update and synchronise option list in doc and help msg 2021-07-30 15:40:27 -07:00
main.c bpftool: Clear errno after libcap's checks 2022-10-26 12:35:32 +02:00
main.h tools: bpftool: Update and synchronise option list in doc and help msg 2021-07-30 15:40:27 -07:00
Makefile tools bpftool: Fix compilation error with new binutils 2023-03-17 08:49:04 +01:00
map.c bpftool: Fix the error when lookup in no-btf maps 2022-04-08 14:23:31 +02:00
map_perf_ring.c tools, bpftool: Poison and replace kernel integer typedefs 2020-05-11 21:20:46 +02:00
net.c tools: bpftool: Update and synchronise option list in doc and help msg 2021-07-30 15:40:27 -07:00
netlink_dumper.c bpftool: Use consistent include paths for libbpf 2020-01-20 16:37:45 -08:00
netlink_dumper.h tools: bpftool: dual license all files 2018-12-13 12:08:44 +01:00
perf.c tools: bpftool: Update and synchronise option list in doc and help msg 2021-07-30 15:40:27 -07:00
pids.c tools/bpftool: Fix PID fetching with a lot of results 2020-12-08 16:45:20 +01:00
prog.c bpftool: Silence build warning about calloc() 2024-03-26 18:21:17 -04:00
struct_ops.c tools: bpftool: Update and synchronise option list in doc and help msg 2021-07-30 15:40:27 -07:00
tracelog.c tools: bpftool: add an option to prevent auto-mount of bpffs, tracefs 2018-12-18 14:47:17 +01:00
xlated_dumper.c bpftool: Fix bug for long instructions in program CFG dumps 2023-05-11 23:00:27 +09:00
xlated_dumper.h tools: bpftool: replace Netronome boilerplate with SPDX license headers 2018-12-13 12:08:44 +01:00