lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <7331A23DB8786121+20250507091340.276092-1-wangyuli@uniontech.com>
Date: Wed,  7 May 2025 17:13:40 +0800
From: WangYuli <wangyuli@...ontech.com>
To: masahiroy@...nel.org,
	nathan@...nel.org,
	nicolas.schier@...ux.dev
Cc: linux-kbuild@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	m.seyfarth@...il.com,
	zhanjun@...ontech.com,
	niecheng1@...ontech.com,
	guanwentao@...ontech.com,
	WangYuli <wangyuli@...ontech.com>
Subject: [PATCH] kbuild: Disable -Wdefault-const-init-var-unsafe

Similar to ("kbuild: Disable -Wdefault-const-init-field-unsafe")
from list, -Wdefault-const-init-var-unsafe need to be disabled too.

While I haven't found this warning triggered in the kernel code
itself (my testing covers just a tiny fraction), it's clearly
something that should be disabled for the same reason.

Additionally, because dkms uses kernel compile parameters, some
out-of-tree modules might also hit this warning, like the Mucse
network driver.

Fix follow error with -Werror:
  drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c:6126:11: error: default initialization of an object of type 'const u8[6]' (aka 'const unsigned char[6]') leaves the object uninitialized and is incompatible with C++ [-Werror,-Wdefault-const-init-var-unsafe]
   6126 |         const u8 target_addr[ETH_ALEN];
        |                  ^
  1 error generated.

Link: https://lore.kernel.org/all/20250501-default-const-init-clang-v1-0-3d2c6c185dbb@kernel.org/
Signed-off-by: WangYuli <wangyuli@...ontech.com>
---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index a7b680df5b24..14e22310fbbf 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -44,6 +44,7 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation-non-kprintf)
 # the field is within a union with other non-const members, or the containing
 # object is not const so the field can be modified via memcpy() / memset().
 KBUILD_CFLAGS += $(call cc-disable-warning, default-const-init-field-unsafe)
+KBUILD_CFLAGS += $(call cc-disable-warning, default-const-init-var-unsafe)
 else
 
 # gcc inanely warns about local variables called 'main'
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ