public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/debug: define BUG() againfor !CONFIG_BUG
@ 2017-03-29 21:16 Arnd Bergmann
  2017-03-30  7:10 ` Peter Zijlstra
  2017-03-30  7:29 ` [tip:x86/asm] x86/debug: Define BUG() again for !CONFIG_BUG tip-bot for Arnd Bergmann
  0 siblings, 2 replies; 9+ messages in thread
From: Arnd Bergmann @ 2017-03-29 21:16 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra
  Cc: Arnd Bergmann, Josh Triplett, Thomas Gleixner, H. Peter Anvin,
	x86, Josh Poimboeuf, linux-kernel

The latest change to the BUG() macro inadvertently reverted the earlier
commit b06dd879f5db ("x86: always define BUG() and HAVE_ARCH_BUG, even
with !CONFIG_BUG") that sanitized the behavior with CONFIG_BUG=n.

I noticed this as some warnings have appeared again that were previously
fixed as a side effect of that patch:

kernel/seccomp.c: In function '__seccomp_filter':
kernel/seccomp.c:670:1: error: no return statement in function returning non-void [-Werror=return-type]

drivers/gpu/drm/i915/intel_sprite.c: In function 'intel_check_sprite_plane':
drivers/gpu/drm/i915/intel_sprite.c:936:20: error: 'src_h' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   src->y2 = (src_y + src_h) << 16;
             ~~~~~~~^~~~~~~~
drivers/gpu/drm/i915/intel_sprite.c:934:20: error: 'src_w' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   src->x2 = (src_x + src_w) << 16;
             ~~~~~~~^~~~~~~~
drivers/gpu/drm/i915/intel_sprite.c:936:20: error: 'src_y' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   src->y2 = (src_y + src_h) << 16;
             ~~~~~~~^~~~~~~~
drivers/gpu/drm/i915/intel_sprite.c:934:20: error: 'src_x' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   src->x2 = (src_x + src_w) << 16;
             ~~~~~~~^~~~~~~~

This combines the two patches and uses the ud2 macro to define BUG()
in case of CONFIG_BUG=n.

Fixes: 9a93848fe787 ("x86/debug: Implement __WARN() using UD0")
Cc: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/bug.h | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/bug.h b/arch/x86/include/asm/bug.h
index 4fde330c44b7..cecf559d0012 100644
--- a/arch/x86/include/asm/bug.h
+++ b/arch/x86/include/asm/bug.h
@@ -23,7 +23,6 @@
 #define LEN_UD0		2
 
 #ifdef CONFIG_GENERIC_BUG
-#define HAVE_ARCH_BUG
 
 #ifdef CONFIG_X86_32
 # define __BUG_REL(val)	".long " __stringify(val)
@@ -64,6 +63,13 @@ do {									\
 
 #endif /* CONFIG_DEBUG_BUGVERBOSE */
 
+#else
+
+#define _BUG_FLAGS(ins, flags)  asm volatile(ins)
+
+#endif /* CONFIG_GENERIC_BUG */
+
+#define HAVE_ARCH_BUG
 #define BUG()							\
 do {								\
 	_BUG_FLAGS(ASM_UD2, 0);					\
@@ -72,8 +78,6 @@ do {								\
 
 #define __WARN_TAINT(taint)	_BUG_FLAGS(ASM_UD0, BUGFLAG_TAINT(taint))
 
-#endif /* CONFIG_GENERIC_BUG */
-
 #include <asm-generic/bug.h>
 
 #endif /* _ASM_X86_BUG_H */
-- 
2.9.0

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

end of thread, other threads:[~2017-03-30  8:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-29 21:16 [PATCH] x86/debug: define BUG() againfor !CONFIG_BUG Arnd Bergmann
2017-03-30  7:10 ` Peter Zijlstra
2017-03-30  7:17   ` Ingo Molnar
2017-03-30  7:26     ` Ingo Molnar
2017-03-30  7:35     ` Peter Zijlstra
2017-03-30  7:47       ` Ingo Molnar
2017-03-30  8:03         ` Arnd Bergmann
2017-03-30  7:25   ` Arnd Bergmann
2017-03-30  7:29 ` [tip:x86/asm] x86/debug: Define BUG() again for !CONFIG_BUG tip-bot for Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox