libbpf: fix compilation warning due to mismatched printf format
Andrii Nakryiko
maintainerPATCH 1/1 libbpf: fix compilation warning due to mismatched printf format
On ppc64le architecture __s64 is long int and requires %ld. Cast to ssize_t and use %zd to avoid architecture-specific specifiers.
--- tools/lib/bpf/btf_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +2 -1
@@ -1869,7 +1869,8 @@ static int btf_dump_array_data(struct btf_dump *d, elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %zd for array type [%u]\n" , + (ssize_t )elem_size, id);return -EINVAL ; }
Signature · 1 line
2.30.2
Quoted 5 lines · Andrii Nakryiko
On ppc64le architecture
__s64is long int and requires %ld. Cast tossize_tand use %zd to avoid architecture-specific specifiers.Fixes 4172843ed4a3 ("libbpf: Fix signedness bug in btf_dump_array_data()")Signed-off-by Andrii Nakryiko <[email protected]>
Quoted 9 lines
--- tools/lib/bpf/btf_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/lib/bpf/btf_dump.c +0
-0
tools/lib/bpf/btf_dump.c static int btf_dump_array_data(struct btf_dump *d, · line 1873
Quoted 6 lines
tools/lib/bpf/btf_dump.c +2
-1@@ -1869,7 +1869,8 @@ static int btf_dump_array_data(struct btf_dump *d, elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %zd for array type [%u]\n" , + (ssize_t )elem_size, id);
Does using "%ld" and "(long)elem_size" work?
Quoted 3 lines
tools/lib/bpf/btf_dump.c +0
-0return -EINVAL ; }
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Daniel Borkmann <[email protected]>:
Quoted 8 lines · On Tue, 8 Feb 2022 22:39:09 -0800 you wrote:
On ppc64le architecture
__s64is long int and requires %ld. Cast tossize_tand use %zd to avoid architecture-specific specifiers.Fixes 4172843ed4a3 ("libbpf: Fix signedness bug in btf_dump_array_data()")Signed-off-by Andrii Nakryiko <[email protected]>--- tools/lib/bpf/btf_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- [bpf-next] libbpf: fix compilation warning due to mismatched printf format
https://git.kernel.org/bpf/bpf-next/c/dc37dc617fab
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html