
The tests for initializing a variable defined between a switch statement's test and its first "case" statement are currently not initialized in Clang[1] nor the proposed auto-initialization feature in GCC. We should retain the test (so that we can evaluate compiler fixes), but mark it as an "expected fail". The rest of the kernel source will be adjusted to avoid this corner case. Also disable -Wswitch-unreachable for the test so that the intentionally broken code won't trigger warnings for GCC (nor future Clang) when initialization happens this unhandled place. [1] https://bugs.llvm.org/show_bug.cgi?id=44916 Suggested-by: Alexander Potapenko <glider@google.com> Signed-off-by: Kees Cook <keescook@chromium.org> [adelva: cherry picking to avoid boot test flakes] Bug: 144999193 Link: https://lore.kernel.org/lkml/202002191358.2897A07C6@keescook/ Change-Id: I0e691f2299ab42526ea306a92551a1188c469136 Signed-off-by: Alistair Delva <adelva@google.com>
11 KiB
11 KiB