Skip to content

Commit 48ede5b

Browse files
committed
bugs/x86: Augment warnings output by concatenating 'cond_str' with the regular __FILE__ string in _BUG_FLAGS()
This allows the reuse of the UD2 based 'struct bug_entry' low-overhead _BUG_FLAGS() implementation and string-printing backend, without having to add a new field. An example: If we have the following WARN_ON_ONCE() in kernel/sched/core.c: WARN_ON_ONCE(idx < 0 && ptr); Then previously _BUG_FLAGS() would store this string in bug_entry::file: "kernel/sched/core.c" After this patch, it would store and print: "[idx < 0 && ptr] kernel/sched/core.c" Which is an extended string that will be printed in warnings. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: linux-arch@vger.kernel.org Link: https://lore.kernel.org/r/20250515124644.2958810-6-mingo@kernel.org
1 parent 407b907 commit 48ede5b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • arch/x86/include/asm

arch/x86/include/asm/bug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ do { \
5050
"\t.org 2b+%c3\n" \
5151
".popsection\n" \
5252
extra \
53-
: : "i" (__FILE__), "i" (__LINE__), \
53+
: : "i" (WARN_CONDITION_STR(cond_str) __FILE__), "i" (__LINE__), \
5454
"i" (flags), \
5555
"i" (sizeof(struct bug_entry))); \
5656
} while (0)

0 commit comments

Comments
 (0)