Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2019-11-06 17:49:33 +0800
committerGary Lin <glin@suse.com>2019-11-06 17:49:37 +0800
commit720fe8bcf2b4f817ca0ec7165e6f3a3a418322f0 (patch)
treeacae5357ba6f5027db6483283e9ad800afe67bf6
parent4e4baf67dc2ee65b7b2ea31064275f402554356c (diff)
tools: bpftool: fix format strings and arguments for
jsonw_printf() (bsc#1155518).
-rw-r--r--patches.suse/tools-bpftool-fix-format-strings-and-arguments-for-j.patch53
-rw-r--r--series.conf1
2 files changed, 54 insertions, 0 deletions
diff --git a/patches.suse/tools-bpftool-fix-format-strings-and-arguments-for-j.patch b/patches.suse/tools-bpftool-fix-format-strings-and-arguments-for-j.patch
new file mode 100644
index 0000000000..5fdfa84764
--- /dev/null
+++ b/patches.suse/tools-bpftool-fix-format-strings-and-arguments-for-j.patch
@@ -0,0 +1,53 @@
+From: Quentin Monnet <quentin.monnet@netronome.com>
+Date: Thu, 15 Aug 2019 15:32:16 +0100
+Subject: tools: bpftool: fix format strings and arguments for jsonw_printf()
+Patch-mainline: v5.4-rc1
+Git-commit: 22c349e8db89df86804d3ba23cef037ccd44a8bf
+References: bsc#1155518
+
+There are some mismatches between format strings and arguments passed to
+jsonw_printf() in the BTF dumper for bpftool, which seems harmless but
+may result in warnings if the "__printf()" attribute is used correctly
+for jsonw_printf(). Let's fix relevant format strings and type cast.
+
+Fixes: b12d6ec09730 ("bpf: btf: add btf print functionality")
+Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
+Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
+Signed-off-by: Alexei Starovoitov <ast@kernel.org>
+Acked-by: Gary Lin <glin@suse.com>
+---
+ tools/bpf/bpftool/btf_dumper.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/tools/bpf/bpftool/btf_dumper.c
++++ b/tools/bpf/bpftool/btf_dumper.c
+@@ -26,9 +26,9 @@ static void btf_dumper_ptr(const void *d
+ bool is_plain_text)
+ {
+ if (is_plain_text)
+- jsonw_printf(jw, "%p", *(unsigned long *)data);
++ jsonw_printf(jw, "%p", data);
+ else
+- jsonw_printf(jw, "%u", *(unsigned long *)data);
++ jsonw_printf(jw, "%lu", *(unsigned long *)data);
+ }
+
+ static int btf_dumper_modifier(const struct btf_dumper *d, __u32 type_id,
+@@ -216,7 +216,7 @@ static int btf_dumper_int(const struct b
+ switch (BTF_INT_ENCODING(*int_type)) {
+ case 0:
+ if (BTF_INT_BITS(*int_type) == 64)
+- jsonw_printf(jw, "%lu", *(__u64 *)data);
++ jsonw_printf(jw, "%llu", *(__u64 *)data);
+ else if (BTF_INT_BITS(*int_type) == 32)
+ jsonw_printf(jw, "%u", *(__u32 *)data);
+ else if (BTF_INT_BITS(*int_type) == 16)
+@@ -229,7 +229,7 @@ static int btf_dumper_int(const struct b
+ break;
+ case BTF_INT_SIGNED:
+ if (BTF_INT_BITS(*int_type) == 64)
+- jsonw_printf(jw, "%ld", *(long long *)data);
++ jsonw_printf(jw, "%lld", *(long long *)data);
+ else if (BTF_INT_BITS(*int_type) == 32)
+ jsonw_printf(jw, "%d", *(int *)data);
+ else if (BTF_INT_BITS(*int_type) == 16)
diff --git a/series.conf b/series.conf
index 3aa7d6e5c9..a9d10d7810 100644
--- a/series.conf
+++ b/series.conf
@@ -1089,6 +1089,7 @@
patches.suse/tools-bpftool-compile-with-EXTRA_WARNINGS.patch
patches.suse/libbpf-make-libbpf.map-source-of-truth-for-libbpf-ve.patch
patches.suse/tools-bpftool-fix-arguments-for-p_err-in-do_event_pi.patch
+ patches.suse/tools-bpftool-fix-format-strings-and-arguments-for-j.patch
patches.suse/btf-fix-return-value-check-in-btf_vmlinux_init.patch
patches.suse/xsk-replace-ndo_xsk_async_xmit-with-ndo_xsk_wakeup.patch
patches.suse/xsk-add-support-for-need_wakeup-flag-in-AF_XDP-rings.patch