mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 15:12:13 +02:00
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
This commit is contained in:
parent
0a52d339d3
commit
4f1b701f24
|
|
@ -74,13 +74,19 @@
|
||||||
".popsection\n" \
|
".popsection\n" \
|
||||||
extra
|
extra
|
||||||
|
|
||||||
|
#ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED
|
||||||
|
#define WARN_CONDITION_STR(cond_str) cond_str
|
||||||
|
#else
|
||||||
|
#define WARN_CONDITION_STR(cond_str) NULL
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _BUG_FLAGS(cond_str, ins, flags, extra) \
|
#define _BUG_FLAGS(cond_str, ins, flags, extra) \
|
||||||
do { \
|
do { \
|
||||||
asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c[fmt]", "%c[file]", \
|
asm_inline volatile(_BUG_FLAGS_ASM(ins, "%c[fmt]", "%c[file]", \
|
||||||
"%c[line]", "%c[fl]", \
|
"%c[line]", "%c[fl]", \
|
||||||
"%c[size]", extra) \
|
"%c[size]", extra) \
|
||||||
: : [fmt] "i" (NULL), \
|
: : [fmt] "i" (WARN_CONDITION_STR(cond_str)), \
|
||||||
[file] "i" (WARN_CONDITION_STR(cond_str) __FILE__), \
|
[file] "i" (__FILE__), \
|
||||||
[line] "i" (__LINE__), \
|
[line] "i" (__LINE__), \
|
||||||
[fl] "i" (flags), \
|
[fl] "i" (flags), \
|
||||||
[size] "i" (sizeof(struct bug_entry))); \
|
[size] "i" (sizeof(struct bug_entry))); \
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,13 @@
|
||||||
#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
|
#define BUG_GET_TAINT(bug) ((bug)->flags >> 8)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef WARN_CONDITION_STR
|
||||||
#ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED
|
#ifdef CONFIG_DEBUG_BUGVERBOSE_DETAILED
|
||||||
# define WARN_CONDITION_STR(cond_str) cond_str
|
# define WARN_CONDITION_STR(cond_str) "[" cond_str "] "
|
||||||
#else
|
#else
|
||||||
# define WARN_CONDITION_STR(cond_str)
|
# define WARN_CONDITION_STR(cond_str)
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* WARN_CONDITION_STR */
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
#ifndef __ASSEMBLY__
|
||||||
#include <linux/panic.h>
|
#include <linux/panic.h>
|
||||||
|
|
@ -107,7 +109,7 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
|
||||||
#define WARN_ON(condition) ({ \
|
#define WARN_ON(condition) ({ \
|
||||||
int __ret_warn_on = !!(condition); \
|
int __ret_warn_on = !!(condition); \
|
||||||
if (unlikely(__ret_warn_on)) \
|
if (unlikely(__ret_warn_on)) \
|
||||||
__WARN_FLAGS("["#condition"] ", \
|
__WARN_FLAGS(#condition, \
|
||||||
BUGFLAG_TAINT(TAINT_WARN)); \
|
BUGFLAG_TAINT(TAINT_WARN)); \
|
||||||
unlikely(__ret_warn_on); \
|
unlikely(__ret_warn_on); \
|
||||||
})
|
})
|
||||||
|
|
@ -117,7 +119,7 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
|
||||||
#define WARN_ON_ONCE(condition) ({ \
|
#define WARN_ON_ONCE(condition) ({ \
|
||||||
int __ret_warn_on = !!(condition); \
|
int __ret_warn_on = !!(condition); \
|
||||||
if (unlikely(__ret_warn_on)) \
|
if (unlikely(__ret_warn_on)) \
|
||||||
__WARN_FLAGS("["#condition"] ", \
|
__WARN_FLAGS(#condition, \
|
||||||
BUGFLAG_ONCE | \
|
BUGFLAG_ONCE | \
|
||||||
BUGFLAG_TAINT(TAINT_WARN)); \
|
BUGFLAG_TAINT(TAINT_WARN)); \
|
||||||
unlikely(__ret_warn_on); \
|
unlikely(__ret_warn_on); \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user