Skip to content

Commit e614876

Browse files
committed
Makefile: Enable -Warray-bounds
With the recent fixes for flexible arrays and expanded FORTIFY_SOURCE coverage, it is now possible to enable -Warray-bounds. Since both GCC and Clang include -Warray-bounds in -Wall, adjust the Makefile to just stop disabling it. Note that this option can be conservative in its warnings (which is done at casting time rather than access time), but this is reasonable since the cast variables may be accessed out of a scope where the true size of the original object can't be evaluated. These handful of false positives (which are arguably bad casts and can be easily avoided), are worth dealing with because of the many places where this option has helped identify missed bounds checks and even accesses done against cases where a NULL pointer could be reached. KSPP#109 KSPP#151 Cc: Arnd Bergmann <[email protected]> Cc: Masahiro Yamada <[email protected]> Cc: [email protected] Co-developed-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Kees Cook <[email protected]>
1 parent dfd42fa commit e614876

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation)
952952

953953
# We'll want to enable this eventually, but it's not going away for 5.7 at least
954954
KBUILD_CFLAGS += $(call cc-disable-warning, zero-length-bounds)
955-
KBUILD_CFLAGS += -Wno-array-bounds
956955
KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow)
957956

958957
# Another good warning that we'll want to enable eventually

0 commit comments

Comments
 (0)