diff mbox series

[17/17,RFC] Makefile.extrawarn: turn on missing-prototypes again

Message ID 20230810141947.1236730-18-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series -Wmissing-prototype warning fixes | expand

Commit Message

Arnd Bergmann Aug. 10, 2023, 2:19 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

Over the years we went from > 1000 of warnings to under 100 earlier
this year, and I sent patches to address all the ones that I saw with
compile testing randcom configs on arm64, arm and x86 kernels. This is a
really useful warning, as it catches real bugs when there are mismatched
prototypes. In particular with kernel control flow integrity enabled,
those are no longer allowed.

Move the options out of the W=1 section to have them enabled by
default.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I'm sure there are still regressions with CONFIG_WERROR when this gets
turned on, but it's getting very close, so it might be best to already
enable this in linux-next but wait one extra merge window to have it in
mainline while the last fixes trickle in.
---
 scripts/Makefile.extrawarn | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Kees Cook Aug. 10, 2023, 7:02 p.m. UTC | #1
On Thu, Aug 10, 2023 at 04:19:35PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> Over the years we went from > 1000 of warnings to under 100 earlier
> this year, and I sent patches to address all the ones that I saw with
> compile testing randcom configs on arm64, arm and x86 kernels. This is a
> really useful warning, as it catches real bugs when there are mismatched
> prototypes. In particular with kernel control flow integrity enabled,
> those are no longer allowed.
> 
> Move the options out of the W=1 section to have them enabled by
> default.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> I'm sure there are still regressions with CONFIG_WERROR when this gets
> turned on, but it's getting very close, so it might be best to already
> enable this in linux-next but wait one extra merge window to have it in
> mainline while the last fixes trickle in.
> ---

Thanks for chasing all of these down!

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees
diff mbox series

Patch

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 40cd13eca82e8..fda5f9087a863 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -15,6 +15,9 @@  ifeq ("$(origin W)", "command line")
   KBUILD_EXTRA_WARN := $(W)
 endif
 
+KBUILD_CFLAGS += -Wmissing-declarations
+KBUILD_CFLAGS += -Wmissing-prototypes
+
 export KBUILD_EXTRA_WARN
 
 #
@@ -23,9 +26,7 @@  export KBUILD_EXTRA_WARN
 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
 
 KBUILD_CFLAGS += -Wextra -Wunused -Wno-unused-parameter
-KBUILD_CFLAGS += -Wmissing-declarations
 KBUILD_CFLAGS += -Wmissing-format-attribute
-KBUILD_CFLAGS += -Wmissing-prototypes
 KBUILD_CFLAGS += -Wold-style-definition
 KBUILD_CFLAGS += -Wmissing-include-dirs
 KBUILD_CFLAGS += $(call cc-option, -Wunused-but-set-variable)