llvm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: Re-enable -Wunterminated-string-initialization
@ 2025-08-02 18:43 Kees Cook
  2025-08-03 17:32 ` Nathan Chancellor
  0 siblings, 1 reply; 9+ messages in thread
From: Kees Cook @ 2025-08-02 18:43 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Kees Cook, Nathan Chancellor, Nicolas Schier, linux-kbuild,
	Nick Desaulniers, Bill Wendling, Justin Stitt, linux-kernel, llvm,
	linux-hardening

With the few remaining fixes now landed, we can re-enable the option
-Wunterminated-string-initialization (via -Wextra). Both GCC and Clang
have the required multi-dimensional nonstring attribute support.

Build tested allmodconfig with:
	gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0
	gcc (GCC) 15.1.1 20250521 (Red Hat 15.1.1-2)
	clang version 20.1.8 (Fedora 20.1.8-1.fc42)
	ClangBuiltLinux clang version 21.1.0-rc2
	clang version 22.0.0git

Signed-off-by: Kees Cook <kees@kernel.org>
---
 v2: Clang is fixed too! :) (Nathan)
 v1: https://lore.kernel.org/lkml/20250802002733.work.941-kees@kernel.org/
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nicolas Schier <nicolas.schier@linux.dev>
Cc: <linux-kbuild@vger.kernel.org>
---
 scripts/Makefile.extrawarn | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index dca175fffcab..a1001377dcb2 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -78,9 +78,6 @@ KBUILD_CFLAGS += $(call cc-option, -Wcast-function-type)
 KBUILD_CFLAGS-$(CONFIG_CC_NO_STRINGOP_OVERFLOW) += $(call cc-option, -Wno-stringop-overflow)
 KBUILD_CFLAGS-$(CONFIG_CC_STRINGOP_OVERFLOW) += $(call cc-option, -Wstringop-overflow)
 
-# Currently, disable -Wunterminated-string-initialization as broken
-KBUILD_CFLAGS += $(call cc-option, -Wno-unterminated-string-initialization)
-
 # The allocators already balk at large sizes, so silence the compiler
 # warnings for bounds checks involving those possible values. While
 # -Wno-alloc-size-larger-than would normally be used here, earlier versions
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-08-11 14:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-02 18:43 [PATCH v2] kbuild: Re-enable -Wunterminated-string-initialization Kees Cook
2025-08-03 17:32 ` Nathan Chancellor
2025-08-05 14:50   ` Alexander Lobakin
2025-08-05 21:48     ` Nathan Chancellor
2025-08-06 15:29       ` Alexander Lobakin
2025-08-06 19:05         ` Kees Cook
2025-08-07 13:31           ` Alexander Lobakin
2025-08-07 22:00             ` Kees Cook
2025-08-11 14:25               ` Alexander Lobakin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).