Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/bug: Use BUG_FORMAT for DEBUG_BUGVERBOSE_DETAILED

Since we have an explicit format string, use it for the condition string
instead of frobbing it in the file string.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20251110115758.097401406@infradead.org

+13 -5
+8 -2
arch/x86/include/asm/bug.h
··· 74 74 ".popsection\n" \ 75 75 extra 76 76 77 + #ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED 78 + #define WARN_CONDITION_STR(cond_str) cond_str 79 + #else 80 + #define WARN_CONDITION_STR(cond_str) NULL 81 + #endif 82 + 77 83 #define _BUG_FLAGS(cond_str, ins, flags, extra) \ 78 84 do { \ 79 85 asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c[fmt]", "%c[file]", \ 80 86 "%c[line]", "%c[fl]", \ 81 87 "%c[size]", extra) \ 82 - : : [fmt] "i" (NULL), \ 83 - [file] "i" (WARN_CONDITION_STR(cond_str) __FILE__), \ 88 + : : [fmt] "i" (WARN_CONDITION_STR(cond_str)), \ 89 + [file] "i" (__FILE__), \ 84 90 [line] "i" (__LINE__), \ 85 91 [fl] "i" (flags), \ 86 92 [size] "i" (sizeof(struct bug_entry))); \
+5 -3
include/asm-generic/bug.h
··· 18 18 #define BUG_GET_TAINT(bug) ((bug)->flags >> 8) 19 19 #endif 20 20 21 + #ifndef WARN_CONDITION_STR 21 22 #ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED 22 - # define WARN_CONDITION_STR(cond_str) cond_str 23 + # define WARN_CONDITION_STR(cond_str) "[" cond_str "] " 23 24 #else 24 25 # define WARN_CONDITION_STR(cond_str) 25 26 #endif 27 + #endif /* WARN_CONDITION_STR */ 26 28 27 29 #ifndef __ASSEMBLY__ 28 30 #include <linux/panic.h> ··· 109 107 #define WARN_ON(condition) ({ \ 110 108 int __ret_warn_on = !!(condition); \ 111 109 if (unlikely(__ret_warn_on)) \ 112 - __WARN_FLAGS("["#condition"] ", \ 110 + __WARN_FLAGS(#condition, \ 113 111 BUGFLAG_TAINT(TAINT_WARN)); \ 114 112 unlikely(__ret_warn_on); \ 115 113 }) ··· 119 117 #define WARN_ON_ONCE(condition) ({ \ 120 118 int __ret_warn_on = !!(condition); \ 121 119 if (unlikely(__ret_warn_on)) \ 122 - __WARN_FLAGS("["#condition"] ", \ 120 + __WARN_FLAGS(#condition, \ 123 121 BUGFLAG_ONCE | \ 124 122 BUGFLAG_TAINT(TAINT_WARN)); \ 125 123 unlikely(__ret_warn_on); \