]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: fix out-of-bounds access warning in bpf_check
authorArnd Bergmann <arnd@arndb.de>
Thu, 2 Nov 2017 11:05:52 +0000 (12:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Nov 2017 05:20:22 +0000 (14:20 +0900)
commit90c90db66f4eb10e21db2f26adeee3636f576eba
tree31b61a4bf69c68a925ffedd626ab3fef0c9b0ba2
parent4c4adf6bf01245e149e2c930f1cf68747c52c9be
bpf: fix out-of-bounds access warning in bpf_check

The bpf_verifer_ops array is generated dynamically and may be
empty depending on configuration, which then causes an out
of bounds access:

kernel/bpf/verifier.c: In function 'bpf_check':
kernel/bpf/verifier.c:4320:29: error: array subscript is above array bounds [-Werror=array-bounds]

This adds a check to the start of the function as a workaround.
I would assume that the function is never called in that configuration,
so the warning is probably harmless.

Fixes: 77b77d78c118 ("bpf: remove the verifier ops from program structure")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/verifier.c