]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpftool: Remove asserts from JIT disassembler
authorQuentin Monnet <quentin@isovalent.com>
Tue, 25 Oct 2022 15:03:23 +0000 (16:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:29 +0000 (19:51 +0100)
commitca906853f6c70c769ac93f9e9b4dedb506de1f3c
tree65ea2f2897c58711632357ba95dd69a572a7a58d
parent3cbde9287469ae02c9a205364be8c5db83106833
bpftool: Remove asserts from JIT disassembler

[ Upstream commit 55b4de58d0e2aca810ed2b198a0173640300acf8 ]

The JIT disassembler in bpftool is the only components (with the JSON
writer) using asserts to check the return values of functions. But it
does not do so in a consistent way, and diasm_print_insn() returns no
value, although sometimes the operation failed.

Remove the asserts, and instead check the return values, print messages
on errors, and propagate the error to the caller from prog.c.

Remove the inclusion of assert.h from jit_disasm.c, and also from map.c
where it is unused.

Signed-off-by: Quentin Monnet <quentin@isovalent.com>
Tested-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Acked-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20221025150329.97371-3-quentin@isovalent.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: ef3ba8c258ee ("bpftool: fix potential NULL pointer dereferencing in prog_dump()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/bpf/bpftool/jit_disasm.c
tools/bpf/bpftool/main.h
tools/bpf/bpftool/map.c
tools/bpf/bpftool/prog.c