Skip to contentSkip to conversation

bpf: Fix build in minimal configurations

PATCH Applied Alexei Starovoitov 3 participants 3 messages Nov 28, 2019 – Nov 29, 2019

Subsystems (3)
lore
Share & tools
lore

Alexei Starovoitov

author maintainer
#0 lore raw

PATCH 1/1 bpf: Fix build in minimal configurations

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.

---
 kernel/bpf/btf.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/btf.c +1 -0
index bd5e11881ba3..7d40da240891 100644
@@ -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) \
Signature · 1 line
2.23.0
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Alexei Starovoitov

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.

Thanks.

Quoted 17 lines
---
 kernel/bpf/btf.c | 1 +
 1 file changed, 1 insertion(+)
kernel/bpf/btf.c +1 -0
index bd5e11881ba3..7d40da240891 100644
@@ -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) \
Signature · 1 line
~Randy