]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpftool: Fix pretty print dump for maps without BTF loaded
authorJiri Olsa <jolsa@kernel.org>
Wed, 16 Feb 2022 09:21:02 +0000 (10:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 11:58:07 +0000 (13:58 +0200)
commit0da0a33b87d1a0715bd5e18c3b77e8dafe8319a7
tree303b1dcb3e857ad017cabd104c65e38dc28b3abd
parente96a17a3c909f788fb1064bc9d9542c8b2d09093
bpftool: Fix pretty print dump for maps without BTF loaded

[ Upstream commit f76d8507d23834f7e56b0fe95c82605e7d7e0efe ]

The commit e5043894b21f ("bpftool: Use libbpf_get_error() to check error")
fails to dump map without BTF loaded in pretty mode (-p option).

Fixing this by making sure get_map_kv_btf won't fail in case there's
no BTF available for the map.

Fixes: e5043894b21f ("bpftool: Use libbpf_get_error() to check error")
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20220216092102.125448-1-jolsa@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/bpf/bpftool/map.c