linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools/bpf: Return the appropriate error value
@ 2020-12-01  3:02 彭浩(Richard)
  2020-12-02  1:38 ` Andrii Nakryiko
  0 siblings, 1 reply; 2+ messages in thread
From: 彭浩(Richard) @ 2020-12-01  3:02 UTC (permalink / raw)
  To: ast, daniel; +Cc: bpf, linux-kernel, 彭浩(Richard)

Compile times error:
"Error: failed to load BTF from /mnt/linux/vmlinux: No such file or directory".
This file "/mnt/linux/vmlinux" actually exists, but only because CONFIG_DEBUG_INFO_BTF
is not configured with this error.

Signed-off-by: Peng Hao <richard.peng@oppo.com>
---
 tools/lib/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 231b07203e3d..228f508fbd04 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -865,7 +865,7 @@ struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext)
        err = 0;

        if (!btf_data) {
-               err = -ENOENT;
+               err = -EPROTO;
                goto done;
        }
        btf = btf__new(btf_data->d_buf, btf_data->d_size);
--
2.18.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools/bpf: Return the appropriate error value
  2020-12-01  3:02 [PATCH] tools/bpf: Return the appropriate error value 彭浩(Richard)
@ 2020-12-02  1:38 ` Andrii Nakryiko
  0 siblings, 0 replies; 2+ messages in thread
From: Andrii Nakryiko @ 2020-12-02  1:38 UTC (permalink / raw)
  To: 彭浩(Richard); +Cc: ast, daniel, bpf, linux-kernel

On Mon, Nov 30, 2020 at 7:06 PM 彭浩(Richard) <richard.peng@oppo.com> wrote:
>
> Compile times error:
> "Error: failed to load BTF from /mnt/linux/vmlinux: No such file or directory".
> This file "/mnt/linux/vmlinux" actually exists, but only because CONFIG_DEBUG_INFO_BTF
> is not configured with this error.
>
> Signed-off-by: Peng Hao <richard.peng@oppo.com>
> ---
>  tools/lib/bpf/btf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 231b07203e3d..228f508fbd04 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -865,7 +865,7 @@ struct btf *btf__parse_elf(const char *path, struct btf_ext **btf_ext)
>         err = 0;
>
>         if (!btf_data) {
> -               err = -ENOENT;
> +               err = -EPROTO;

ENOENT as related to "no .BTF section found"... EPROTO would make
sense as well, but I don't think we need to really change anything.
"Protocol error" isn't very meaningful either...


>                 goto done;
>         }
>         btf = btf__new(btf_data->d_buf, btf_data->d_size);
> --
> 2.18.4

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-12-02  1:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01  3:02 [PATCH] tools/bpf: Return the appropriate error value 彭浩(Richard)
2020-12-02  1:38 ` Andrii Nakryiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).