]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
libbpf: fix error code returned on corrupted ELF
authorAndrii Nakryiko <andriin@fb.com>
Wed, 29 May 2019 17:36:07 +0000 (10:36 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 29 May 2019 23:23:35 +0000 (01:23 +0200)
All of libbpf errors are negative, except this one. Fix it.

Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c

index 60ec9694923a7a2dc1f6d3d9f500a1820f46a907..9f421206d3e7bf0471d80e8df16f1663f3527a7e 100644 (file)
@@ -1221,7 +1221,7 @@ static int bpf_object__elf_collect(struct bpf_object *obj, int flags)
 
        if (!obj->efile.strtabidx || obj->efile.strtabidx >= idx) {
                pr_warning("Corrupted ELF file: index of strtab invalid\n");
-               return LIBBPF_ERRNO__FORMAT;
+               return -LIBBPF_ERRNO__FORMAT;
        }
        if (btf_data) {
                obj->btf = btf__new(btf_data->d_buf, btf_data->d_size);