diff options
| author | Pu Lehui <[email protected]> | 2025-01-15 10:02:39 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2025-01-16 23:34:18 +0000 |
| commit | 5436a54332c19df0acbef2b87cbf9f7cba56f2dd (patch) | |
| tree | 0ba7857af7c0ea869c797c3d120b403f4830c3ef | |
| parent | selftests/bpf: Fix btf leak on new btf alloc failure in btf_distill test (diff) | |
| download | kernel-5436a54332c19df0acbef2b87cbf9f7cba56f2dd.tar.gz kernel-5436a54332c19df0acbef2b87cbf9f7cba56f2dd.zip | |
libbpf: Fix return zero when elf_begin failed
The error number of elf_begin is omitted when encapsulating the
btf_find_elf_sections function.
Fixes: c86f180ffc99 ("libbpf: Make btf_parse_elf process .BTF.base transparently")
Signed-off-by: Pu Lehui <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
| -rw-r--r-- | tools/lib/bpf/btf.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index a4ae2df68b91..48c66f3a9200 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -1186,6 +1186,7 @@ static struct btf *btf_parse_elf(const char *path, struct btf *base_btf, elf = elf_begin(fd, ELF_C_READ, NULL); if (!elf) { + err = -LIBBPF_ERRNO__FORMAT; pr_warn("failed to open %s as ELF file\n", path); goto done; } |
