lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ec813c26-696f-44c2-8681-6bf13ce6b5d8@isovalent.com>
Date: Tue, 16 Jan 2024 11:15:56 +0000
From: Quentin Monnet <quentin@...valent.com>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>, Alexei Starovoitov
 <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
 Andrii Nakryiko <andrii@...nel.org>
Cc: bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v1] bpftool: Silence build warning about calloc()

2024-01-16 06:19 UTC+0000 ~ Tiezhu Yang <yangtiezhu@...ngson.cn>
> 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: 47c09d6a9f67 ("bpftool: Introduce "prog profile" command")
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>

Reviewed-by: Quentin Monnet <quentin@...valent.com>

Thank you!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ