linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Lau <kafai@fb.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Randy Dunlap <rdunlap@infradead.org>,
	Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
	Andrii Nakryiko <andriin@fb.com>,
	Quentin Monnet <quentin.monnet@netronome.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bpf: Fix build in minimal configurations, again
Date: Tue, 10 Dec 2019 23:34:24 +0000	[thread overview]
Message-ID: <20191210233421.vnybkzc6noskmsjt@kafai-mbp> (raw)
In-Reply-To: <20191210203553.2941035-1-arnd@arndb.de>

On Tue, Dec 10, 2019 at 09:35:46PM +0100, Arnd Bergmann wrote:
> Building with -Werror showed another failure:
> 
> kernel/bpf/btf.c: In function 'btf_get_prog_ctx_type.isra.31':
> kernel/bpf/btf.c:3508:63: error: array subscript 0 is above array bounds of 'u8[0]' {aka 'unsigned char[0]'} [-Werror=array-bounds]
>   ctx_type = btf_type_member(conv_struct) + bpf_ctx_convert_map[prog_type] * 2;
> 
> I don't actually understand why the array is empty, but a similar
> fix has addressed a related problem, so I suppose we can do the
> same thing here.
> 
> Fixes: ce27709b8162 ("bpf: Fix build in minimal configurations")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  kernel/bpf/btf.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 7d40da240891..ed2075884724 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -3470,6 +3470,7 @@ static u8 bpf_ctx_convert_map[] = {
>  	[_id] = __ctx_convert##_id,
>  #include <linux/bpf_types.h>
>  #undef BPF_PROG_TYPE
> +	0, /* avoid empty array */
If bpf_types.h is empty, the prog should have already failed
earlier in find_prog_type() in syscall.c, so 0 here should
be fine.

Acked-by: Martin KaFai Lau <kafai@fb.com>

  reply	other threads:[~2019-12-10 23:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 20:35 [PATCH] bpf: Fix build in minimal configurations, again Arnd Bergmann
2019-12-10 23:34 ` Martin Lau [this message]
2019-12-11 13:00 ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210233421.vnybkzc6noskmsjt@kafai-mbp \
    --to=kafai@fb.com \
    --cc=andriin@fb.com \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=quentin.monnet@netronome.com \
    --cc=rdunlap@infradead.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).