]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix compile error in libbpf_attach_type_by_name
authorAndrey Ignatov <rdna@fb.com>
Wed, 31 Oct 2018 19:57:18 +0000 (12:57 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 31 Oct 2018 22:06:17 +0000 (23:06 +0100)
commitd53a59e6d9dfd512d58b28fd83acb5b904821f96
treefd8df6356914077abfcfe6434ae664de3ba32b1a
parent0e427300aa7eecd49b612187cdf0599fc1adfb53
libbpf: Fix compile error in libbpf_attach_type_by_name

Arnaldo Carvalho de Melo reported build error in libbpf when clang
version 3.8.1-24 (tags/RELEASE_381/final) is used:

libbpf.c:2201:36: error: comparison of constant -22 with expression of
type 'const enum bpf_attach_type' is always false
[-Werror,-Wtautological-constant-out-of-range-compare]
                if (section_names[i].attach_type == -EINVAL)
                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~
1 error generated.

Fix the error by keeping "is_attachable" property of a program in a
separate struct field instead of trying to use attach_type itself.

Fixes: 1374d20eeb33 ("libbpf: Introduce libbpf_attach_type_by_name")
Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Andrey Ignatov <rdna@fb.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c