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: <20201026215004.3893088-1-arnd@kernel.org>
Date:   Mon, 26 Oct 2020 22:49:59 +0100
From:   Arnd Bergmann <arnd@...nel.org>
To:     Andrew Morton <akpm@...ux-foundation.org>,
        Petr Mladek <pmladek@...e.com>,
        Uwe Kleine-König <uwe@...ine-koenig.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>,
        Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: [PATCH] printf: fix Woverride-init warning for EDEADLK errno

From: Arnd Bergmann <arnd@...db.de>

On most architectures, gcc -Wextra warns about the list of error
numbers containing both EDEADLK and EDEADLOCK:

lib/errname.c:15:67: warning: initialized field overwritten [-Woverride-init]
   15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
      |                                                                   ^~~
lib/errname.c:172:2: note: in expansion of macro 'E'
  172 |  E(EDEADLK), /* EDEADLOCK */
      |  ^
lib/errname.c:15:67: note: (near initialization for 'names_0[35]')
   15 | #define E(err) [err + BUILD_BUG_ON_ZERO(err <= 0 || err > 300)] = "-" #err
      |                                                                   ^~~
lib/errname.c:172:2: note: in expansion of macro 'E'
  172 |  E(EDEADLK), /* EDEADLOCK */
      |  ^

Make that line conditional on the two values being distinct.

Fixes: 57f5677e535b ("printf: add support for printing symbolic error names")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 lib/errname.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/errname.c b/lib/errname.c
index 0c4d3e66170e..6adff0bf2445 100644
--- a/lib/errname.c
+++ b/lib/errname.c
@@ -169,7 +169,9 @@ static const char *names_0[] = {
 	E(ECANCELED), /* ECANCELLED */
 	E(EAGAIN), /* EWOULDBLOCK */
 	E(ECONNREFUSED), /* EREFUSED */
+#if EDEADLK != EDEADLOCK
 	E(EDEADLK), /* EDEADLOCK */
+#endif
 };
 #undef E
 
-- 
2.27.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ