diff options
| author | Jose E. Marchesi <[email protected]> | 2024-05-07 18:47:56 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2024-05-08 16:55:27 +0000 |
| commit | cd3fc3b9782130a5bc1dc3dfccffbc1657637a93 (patch) | |
| tree | cf872dd7603e1ac693cd05426198ccaa6fc13ffd /tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c | |
| parent | bpf, arm64: Add support for lse atomics in bpf_arena (diff) | |
| download | kernel-cd3fc3b9782130a5bc1dc3dfccffbc1657637a93.tar.gz kernel-cd3fc3b9782130a5bc1dc3dfccffbc1657637a93.zip | |
bpf: avoid uninitialized warnings in verifier_global_subprogs.c
[Changes from V1:
- The warning to disable is -Wmaybe-uninitialized, not -Wuninitialized.
- This warning is only supported in GCC.]
The BPF selftest verifier_global_subprogs.c contains code that
purposedly performs out of bounds access to memory, to check whether
the kernel verifier is able to catch them. For example:
__noinline int global_unsupp(const int *mem)
{
if (!mem)
return 0;
return mem[100]; /* BOOM */
}
With -O1 and higher and no inlining, GCC notices this fact and emits a
"maybe uninitialized" warning. This is by design. Note that the
emission of these warnings is highly dependent on the precise
optimizations that are performed.
This patch adds a compiler pragma to verifier_global_subprogs.c to
ignore these warnings.
Tested in bpf-next master.
No regressions.
Signed-off-by: Jose E. Marchesi <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Yonghong Song <[email protected]>
Cc: Eduard Zingerman <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/tcp_custom_syncookie.c')
0 files changed, 0 insertions, 0 deletions
