Files
linux-stable-mirror/include/linux
Arnd BergmannandDaniel Borkmann d26c0cc539 bpf: Avoid gcc-10 stringop-overflow warning in struct bpf_prog
gcc-10 warns about accesses to zero-length arrays:

kernel/bpf/core.c: In function 'bpf_patch_insn_single':
cc1: warning: writing 8 bytes into a region of size 0 [-Wstringop-overflow=]
In file included from kernel/bpf/core.c:21:
include/linux/filter.h:550:20: note: at offset 0 to object 'insnsi' with size 0 declared here
  550 |   struct bpf_insn  insnsi[0];
      |                    ^~~~~~

In this case, we really want to have two flexible-array members,
but that is not possible. Removing the union to make insnsi a
flexible-array member while leaving insns as a zero-length array
fixes the warning, as nothing writes to the other one in that way.

This trick only works on linux-3.18 or higher, as older versions
had additional members in the union.

Fixes: 60a3b2253c ("net: bpf: make eBPF interpreter images read-only")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200430213101.135134-6-arnd@arndb.de
2020-05-04 22:54:42 +02:00
..
2020-03-31 21:29:04 +02:00
2020-04-10 15:36:21 -07:00
2020-03-27 20:19:24 -03:00
2020-04-15 11:48:21 +02:00
2020-04-30 12:54:01 -07:00
2020-04-10 15:36:21 -07:00
2020-04-07 10:43:38 -07:00
2020-04-02 09:35:27 -07:00
2020-04-07 10:43:38 -07:00
2020-04-24 16:47:51 -07:00
2020-04-07 10:43:42 -07:00
2020-04-30 13:24:01 -07:00
2020-04-17 06:05:30 -04:00
2020-04-01 12:06:26 -04:00
2020-04-17 06:05:30 -04:00