mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
tools, bpftool: Print correct error message when failing to load BTF
btf__parse_raw and btf__parse_elf return negative error numbers wrapped in an ERR_PTR, so the extracted value needs to be negated before passing them to strerror which expects a positive error number. Before: Error: failed to load BTF from .../vmlinux: Unknown error -2 After: Error: failed to load BTF from .../vmlinux: No such file or directory Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200525135421.4154-1-tklauser@distanz.ch Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
73a4f0407e
commit
dc3ca5cf3e
1 changed files with 1 additions and 1 deletions
|
@ -553,7 +553,7 @@ static int do_dump(int argc, char **argv)
|
||||||
btf = btf__parse_elf(*argv, NULL);
|
btf = btf__parse_elf(*argv, NULL);
|
||||||
|
|
||||||
if (IS_ERR(btf)) {
|
if (IS_ERR(btf)) {
|
||||||
err = PTR_ERR(btf);
|
err = -PTR_ERR(btf);
|
||||||
btf = NULL;
|
btf = NULL;
|
||||||
p_err("failed to load BTF from %s: %s",
|
p_err("failed to load BTF from %s: %s",
|
||||||
*argv, strerror(err));
|
*argv, strerror(err));
|
||||||
|
|
Loading…
Reference in a new issue