]> www.infradead.org Git - linux.git/commitdiff
ubsan: fix unused variable warning in test module
authorArnd Bergmann <arnd@arndb.de>
Wed, 3 Apr 2024 08:06:20 +0000 (10:06 +0200)
committerKees Cook <keescook@chromium.org>
Wed, 3 Apr 2024 21:35:57 +0000 (14:35 -0700)
This is one of the drivers with an unused variable that is marked 'const'.
Adding a __used annotation here avoids the warning and lets us enable
the option by default:

lib/test_ubsan.c:137:28: error: unused variable 'skip_ubsan_array' [-Werror,-Wunused-const-variable]

Fixes: 4a26f49b7b3d ("ubsan: expand tests and reporting")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240403080702.3509288-3-arnd@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
lib/test_ubsan.c

index 276c12140ee26dac37137e400f4c303d34045bb1..c288df9372ede1cbda1371ae92e20a25ae9ebe91 100644 (file)
@@ -134,7 +134,7 @@ static const test_ubsan_fp test_ubsan_array[] = {
 };
 
 /* Excluded because they Oops the module. */
-static const test_ubsan_fp skip_ubsan_array[] = {
+static __used const test_ubsan_fp skip_ubsan_array[] = {
        test_ubsan_divrem_overflow,
 };