bpf: Fix build in minimal configurations
authorAlexei Starovoitov <ast@kernel.org>
Thu, 28 Nov 2019 04:35:08 +0000 (20:35 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 29 Nov 2019 00:03:42 +0000 (01:03 +0100)
Some kconfigs can have BPF enabled without a single valid program type.
In such configurations the build will fail with:
./kernel/bpf/btf.c:3466:1: error: empty enum is invalid

Fix it by adding unused value to the enum.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Link: https://lore.kernel.org/bpf/20191128043508.2346723-1-ast@kernel.org
kernel/bpf/btf.c

index bd5e11881ba3b6e5daa704a3f0d161c15c20fc3d..7d40da240891d3b0885ad97d1c43b0fa50611081 100644 (file)
@@ -3463,6 +3463,7 @@ enum {
        __ctx_convert##_id,
 #include <linux/bpf_types.h>
 #undef BPF_PROG_TYPE
+       __ctx_convert_unused, /* to avoid empty enum in extreme .config */
 };
 static u8 bpf_ctx_convert_map[] = {
 #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \