UPSTREAM: include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures

For architectures using __WARN_TAINT, the WARN_ON macro did not print
out the "cut here" string.  The other WARN_XXX macros would print "cut
here" inside __warn_printk, which is not called for WARN_ON since it
doesn't have a message to print.

Fixes: a7bed27af194 ("bug: fix "cut here" location for __WARN_TAINT architectures")
Signed-off-by: Drew Davenport <>
Acked-by: Kees Cook <>
Tested-by: Kees Cook <>
Cc: <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
(cherry picked from commit 6b15f678fb7d5ef54e089e6ace72f007fe6e9895)

TEST=manual: `echo WARNING > /sys/kernel/debug/provoke-crash/DIRECT` and
     watch /var/spool/crash/
     TODO: resurrect platform_AnomalyDetector

Change-Id: I8cd9f84402da285e6d11111a1e57e549e9e51560
Signed-off-by: Brian Norris <>
Legacy-Commit-Queue: Commit Bot <>
Reviewed-by: Sean Paul <>
Reviewed-by: Guenter Roeck <>
(cherry picked from commit 40f4f347d014615dbac8d9c0634395c021795bdc)
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index c21ff27..79feb1a 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -94,8 +94,10 @@
 	warn_slowpath_fmt_taint(__FILE__, __LINE__, taint, arg)
 extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
-#define __WARN_printf(arg...)	do { __warn_printk(arg); __WARN(); } while (0)
+#define __WARN() do { \
+} while (0)
+#define __WARN_printf(arg...)	__WARN_printf_taint(TAINT_WARN, arg)
 #define __WARN_printf_taint(taint, arg...)				\
 	do { __warn_printk(arg); __WARN_TAINT(taint); } while (0)