Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  • Kees Cook's avatar
    Makefile: Enable -Warray-bounds · e6148767
    Kees Cook authored
    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.
    
    https://github.com/KSPP/linux/issues/109
    https://github.com/KSPP/linux/issues/151
    
    
    
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Masahiro Yamada <masahiroy@kernel.org>
    Cc: linux-kbuild@vger.kernel.org
    Co-developed-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
    Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
    Signed-off-by: default avatarKees Cook <keescook@chromium.org>
    e6148767
Forked from BeagleBoard.org / Linux
Loading