BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH bpf] bpf: Fix build in minimal configurations
@ 2019-11-28  4:35 Alexei Starovoitov
  2019-11-28  4:56 ` Randy Dunlap
  2019-11-29  0:25 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2019-11-28  4:35 UTC (permalink / raw)
  To: davem; +Cc: daniel, rdunlap, netdev, bpf, kernel-team

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>
---
 kernel/bpf/btf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index bd5e11881ba3..7d40da240891 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -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) \
-- 
2.23.0


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

* Re: [PATCH bpf] bpf: Fix build in minimal configurations
  2019-11-28  4:35 [PATCH bpf] bpf: Fix build in minimal configurations Alexei Starovoitov
@ 2019-11-28  4:56 ` Randy Dunlap
  2019-11-29  0:25 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2019-11-28  4:56 UTC (permalink / raw)
  To: Alexei Starovoitov, davem; +Cc: daniel, netdev, bpf, kernel-team

On 11/27/19 8:35 PM, Alexei Starovoitov wrote:
> 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>

Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested

Thanks.

> ---
>  kernel/bpf/btf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index bd5e11881ba3..7d40da240891 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -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) \
> 


-- 
~Randy


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

* Re: [PATCH bpf] bpf: Fix build in minimal configurations
  2019-11-28  4:35 [PATCH bpf] bpf: Fix build in minimal configurations Alexei Starovoitov
  2019-11-28  4:56 ` Randy Dunlap
@ 2019-11-29  0:25 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-11-29  0:25 UTC (permalink / raw)
  To: Alexei Starovoitov, davem; +Cc: rdunlap, netdev, bpf, kernel-team

On 11/28/19 5:35 AM, Alexei Starovoitov wrote:
> 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>

Applied, thanks!

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-28  4:35 [PATCH bpf] bpf: Fix build in minimal configurations Alexei Starovoitov
2019-11-28  4:56 ` Randy Dunlap
2019-11-29  0:25 ` Daniel Borkmann

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git