diff options
author | Jose E. Marchesi <[email protected]> | 2024-05-07 20:47:56 +0200 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2024-05-08 09:55:27 -0700 |
commit | cd3fc3b9782130a5bc1dc3dfccffbc1657637a93 (patch) | |
tree | cf872dd7603e1ac693cd05426198ccaa6fc13ffd /drivers/usb/cdns3/cdns3-trace.c | |
parent | e612b5c1d3ee325aff991b4078b4999bf6bac096 (diff) |
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 'drivers/usb/cdns3/cdns3-trace.c')
0 files changed, 0 insertions, 0 deletions