Commit 4c80c7bc authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Daniel Borkmann

bpf: Fix build in minimal configurations, again

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: ce27709b ("bpf: Fix build in minimal configurations")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191210203553.2941035-1-arnd@arndb.de
parent e49e6f6d
...@@ -3470,6 +3470,7 @@ static u8 bpf_ctx_convert_map[] = { ...@@ -3470,6 +3470,7 @@ static u8 bpf_ctx_convert_map[] = {
[_id] = __ctx_convert##_id, [_id] = __ctx_convert##_id,
#include <linux/bpf_types.h> #include <linux/bpf_types.h>
#undef BPF_PROG_TYPE #undef BPF_PROG_TYPE
0, /* avoid empty array */
}; };
#undef BPF_MAP_TYPE #undef BPF_MAP_TYPE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment