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: <20210407002450.10015-1-kabel@kernel.org>
Date:   Wed,  7 Apr 2021 02:24:50 +0200
From:   Marek Behún <kabel@...nel.org>
To:     linux-kbuild@...r.kernel.org
Cc:     Marek Behún <kabel@...nel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Nathan Chancellor <natechancellor@...il.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org
Subject: [PATCH kbuild] Makefile.extrawarn: disable -Woverride-init in W=1

The -Wextra flag enables -Woverride-init in newer versions of GCC.

This causes the compiler to warn when a value is written twice in a
designated initializer, for example:
  int x[1] = {
    [0] = 3,
    [0] = 3,
  };

Note that for clang, this was disabled from the beginning with
-Wno-initializer-overrides in commit a1494304346a3 ("kbuild: add all
Clang-specific flags unconditionally").

This prevents us from implementing complex macros for compile-time
initializers.

For example a macro of the form INITIALIZE_BITMAP(bits...) that can be
used as
  static DECLARE_BITMAP(bm, 64) = INITIALIZE_BITMAP(0, 1, 32, 33);
can only be implemented by allowing a designated initializer to
initialize the same members multiple times (because the compiler
complains even if the multiple initializations initialize to the same
value).

Disable the -Woverride-init flag.

Signed-off-by: Marek Behún <kabel@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Nathan Chancellor <natechancellor@...il.com>
Cc: Masahiro Yamada <masahiroy@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org
---
 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index d53825503874..cf7bc1eec5e3 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -36,6 +36,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
 KBUILD_CFLAGS += -Wno-missing-field-initializers
 KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -Wno-type-limits
+KBUILD_CFLAGS += $(call cc-disable-warning, override-init)
 
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
 
-- 
2.26.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ