Re: [PATCH bpf-next] libbpf: fix compilation warning due to mismatched printf format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 2/8/22 10:39 PM, Andrii Nakryiko wrote:
On ppc64le architecture __s64 is long int and requires %ld. Cast to
ssize_t and use %zd to avoid architecture-specific specifiers.

Fixes: 4172843ed4a3 ("libbpf: Fix signedness bug in btf_dump_array_data()")
Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

Acked-by: Yonghong Song <yhs@xxxxxx>

---
  tools/lib/bpf/btf_dump.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/lib/bpf/btf_dump.c b/tools/lib/bpf/btf_dump.c
index 55aed9e398c3..07ebe70d3a30 100644
--- a/tools/lib/bpf/btf_dump.c
+++ b/tools/lib/bpf/btf_dump.c
@@ -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?

  		return -EINVAL;
  	}



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux