]> git.baikalelectronics.ru Git - kernel.git/commit
tools, bpftool: Print correct error message when failing to load BTF
authorTobias Klauser <tklauser@distanz.ch>
Mon, 25 May 2020 13:54:21 +0000 (15:54 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 1 Jun 2020 21:38:19 +0000 (14:38 -0700)
commit72d9c957dc8c7cd9f7da9b2d08af40051164f05b
treed7393cd6ba68b08787e37d9414c32a9ce10fbdf4
parenta2951dc332a2cff80a258870897fb584b03792e5
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>
tools/bpf/bpftool/btf.c