Skip to content

Commit 1fa568e

Browse files
Shida Zhangsuryasaimadhu
authored andcommitted
bug: Have __warn() prototype defined unconditionally
The __warn() prototype is declared in CONFIG_BUG scope but the function definition in panic.c is unconditional. The IBT enablement started using it unconditionally but a CONFIG_X86_KERNEL_IBT=y, CONFIG_BUG=n .config will trigger a arch/x86/kernel/traps.c: In function ‘__exc_control_protection’: arch/x86/kernel/traps.c:249:17: error: implicit declaration of function \ ‘__warn’; did you mean ‘pr_warn’? [-Werror=implicit-function-declaration] Pull up the declarations so that they're unconditionally visible too. [ bp: Rewrite commit message. ] Fixes: 991625f ("x86/ibt: Add IBT feature, MSR and #CP handling") Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Shida Zhang <zhangshida@kylinos.cn> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20220426032007.510245-1-starzhangzsd@gmail.com
1 parent 4cdfc11 commit 1fa568e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

include/asm-generic/bug.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
#include <linux/panic.h>
2222
#include <linux/printk.h>
2323

24+
struct warn_args;
25+
struct pt_regs;
26+
27+
void __warn(const char *file, int line, void *caller, unsigned taint,
28+
struct pt_regs *regs, struct warn_args *args);
29+
2430
#ifdef CONFIG_BUG
2531

2632
#ifdef CONFIG_GENERIC_BUG
@@ -110,11 +116,6 @@ extern __printf(1, 2) void __warn_printk(const char *fmt, ...);
110116
#endif
111117

112118
/* used internally by panic.c */
113-
struct warn_args;
114-
struct pt_regs;
115-
116-
void __warn(const char *file, int line, void *caller, unsigned taint,
117-
struct pt_regs *regs, struct warn_args *args);
118119

119120
#ifndef WARN_ON
120121
#define WARN_ON(condition) ({ \

0 commit comments

Comments
 (0)