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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <171277954823.10875.13569747246376964639.tip-bot2@tip-bot2>
Date: Wed, 10 Apr 2024 20:05:48 -0000
From: "tip-bot2 for Adrian Hunter" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Naresh Kamboju <naresh.kamboju@...aro.org>,
 Adrian Hunter <adrian.hunter@...el.com>, Thomas Gleixner <tglx@...utronix.de>,
 Linux Kernel Functional Testing <lkft@...aro.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject:
 [tip: timers/urgent] bug: Fix no-return-statement warning with !CONFIG_BUG

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     5284984a4fbacb0883bfebe905902cdda2891a07
Gitweb:        https://git.kernel.org/tip/5284984a4fbacb0883bfebe905902cdda2891a07
Author:        Adrian Hunter <adrian.hunter@...el.com>
AuthorDate:    Wed, 10 Apr 2024 18:32:12 +03:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Wed, 10 Apr 2024 22:01:35 +02:00

bug: Fix no-return-statement warning with !CONFIG_BUG

BUG() does not return, and arch implementations of BUG() use unreachable()
or other non-returning code. However with !CONFIG_BUG, the default
implementation is often used instead, and that does not do that. x86 always
uses its own implementation, but powerpc with !CONFIG_BUG gives a build
error:

  kernel/time/timekeeping.c: In function ‘timekeeping_debug_get_ns’:
  kernel/time/timekeeping.c:286:1: error: no return statement in function
  returning non-void [-Werror=return-type]

Add unreachable() to default !CONFIG_BUG BUG() implementation.

Fixes: e8e9d21a5df6 ("timekeeping: Refactor timekeeping helpers")
Reported-by: Naresh Kamboju <naresh.kamboju@...aro.org>
Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Linux Kernel Functional Testing <lkft@...aro.org>
Link: https://lore.kernel.org/r/20240410153212.127477-1-adrian.hunter@intel.com
Closes: https://lore.kernel.org/all/CA+G9fYvjdZCW=7ZGxS6A_3bysjQ56YF7S-+PNLQ_8a4DKh1Bhg@mail.gmail.com/
---
 include/asm-generic/bug.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 6e79442..b7de3a4 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -156,7 +156,10 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
 
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
-#define BUG() do {} while (1)
+#define BUG() do {		\
+	do {} while (1);	\
+	unreachable();		\
+} while (0)
 #endif
 
 #ifndef HAVE_ARCH_BUG_ON

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ