[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200124141817.28793-50-sashal@kernel.org>
Date: Fri, 24 Jan 2020 09:17:20 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Martin KaFai Lau <kafai@...com>,
Alexei Starovoitov <ast@...nel.org>,
Quentin Monnet <quentin.monnet@...ronome.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH AUTOSEL 5.4 050/107] bpftool: Fix printing incorrect pointer in btf_dump_ptr
From: Martin KaFai Lau <kafai@...com>
[ Upstream commit 555089fdfc37ad65e0ee9b42ca40c238ff546f83 ]
For plain text output, it incorrectly prints the pointer value
"void *data". The "void *data" is actually pointing to memory that
contains a bpf-map's value. The intention is to print the content of
the bpf-map's value instead of printing the pointer pointing to the
bpf-map's value.
In this case, a member of the bpf-map's value is a pointer type.
Thus, it should print the "*(void **)data".
Fixes: 22c349e8db89 ("tools: bpftool: fix format strings and arguments for jsonw_printf()")
Signed-off-by: Martin KaFai Lau <kafai@...com>
Signed-off-by: Alexei Starovoitov <ast@...nel.org>
Reviewed-by: Quentin Monnet <quentin.monnet@...ronome.com>
Link: https://lore.kernel.org/bpf/20200110231644.3484151-1-kafai@fb.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
tools/bpf/bpftool/btf_dumper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c
index d66131f696892..397e5716ab6d8 100644
--- a/tools/bpf/bpftool/btf_dumper.c
+++ b/tools/bpf/bpftool/btf_dumper.c
@@ -26,7 +26,7 @@ static void btf_dumper_ptr(const void *data, json_writer_t *jw,
bool is_plain_text)
{
if (is_plain_text)
- jsonw_printf(jw, "%p", data);
+ jsonw_printf(jw, "%p", *(void **)data);
else
jsonw_printf(jw, "%lu", *(unsigned long *)data);
}
--
2.20.1
Powered by blists - more mailing lists