public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* [peterz-queue:x86/urgent 2/2] arch/x86/kernel/traps.c:400:14: warning: no previous prototype for function 'handle_bug'
@ 2026-01-12 21:17 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-01-12 21:17 UTC (permalink / raw)
  To: Hou Wenlong; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git x86/urgent
head:   695d896472d6543523de43110b0016b8b4469643
commit: 695d896472d6543523de43110b0016b8b4469643 [2/2] x86_64/bug: Handle __WARN_printf() trap in early_fixup_exception()
config: i386-buildonly-randconfig-002-20260113 (https://download.01.org/0day-ci/archive/20260113/202601130559.lb8bMZHD-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260113/202601130559.lb8bMZHD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601130559.lb8bMZHD-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/kernel/traps.c:400:14: warning: no previous prototype for function 'handle_bug' [-Wmissing-prototypes]
     400 | noinstr bool handle_bug(struct pt_regs *regs)
         |              ^
   arch/x86/kernel/traps.c:400:9: note: declare 'static' if the function is not intended to be used outside of this translation unit
     400 | noinstr bool handle_bug(struct pt_regs *regs)
         |         ^
         |         static 
   1 warning generated.


vim +/handle_bug +400 arch/x86/kernel/traps.c

   399	
 > 400	noinstr bool handle_bug(struct pt_regs *regs)
   401	{
   402		unsigned long addr = regs->ip;
   403		bool handled = false;
   404		int ud_type, ud_len;
   405		s32 ud_imm;
   406	
   407		ud_type = decode_bug(addr, &ud_imm, &ud_len);
   408		if (ud_type == BUG_NONE)
   409			return handled;
   410	
   411		/*
   412		 * All lies, just get the WARN/BUG out.
   413		 */
   414		instrumentation_begin();
   415		/*
   416		 * Normally @regs are unpoisoned by irqentry_enter(), but handle_bug()
   417		 * is a rare case that uses @regs without passing them to
   418		 * irqentry_enter().
   419		 */
   420		kmsan_unpoison_entry_regs(regs);
   421		/*
   422		 * Since we're emulating a CALL with exceptions, restore the interrupt
   423		 * state to what it was at the exception site.
   424		 */
   425		if (regs->flags & X86_EFLAGS_IF)
   426			raw_local_irq_enable();
   427	
   428		switch (ud_type) {
   429		case BUG_UD1_WARN:
   430			if (report_bug_entry((void *)pt_regs_val(regs, ud_imm), regs) == BUG_TRAP_TYPE_WARN)
   431				handled = true;
   432			break;
   433	
   434		case BUG_UD2:
   435			if (report_bug(regs->ip, regs) == BUG_TRAP_TYPE_WARN) {
   436				handled = true;
   437				break;
   438			}
   439			fallthrough;
   440	
   441		case BUG_UDB:
   442		case BUG_LOCK:
   443			if (handle_cfi_failure(regs) == BUG_TRAP_TYPE_WARN) {
   444				handled = true;
   445				break;
   446			}
   447			break;
   448	
   449		case BUG_UD1_UBSAN:
   450			if (IS_ENABLED(CONFIG_UBSAN_TRAP)) {
   451				pr_crit("%s at %pS\n",
   452					report_ubsan_failure(ud_imm),
   453					(void *)regs->ip);
   454			}
   455			break;
   456	
   457		default:
   458			break;
   459		}
   460	
   461		/*
   462		 * When continuing, and regs->ip hasn't changed, move it to the next
   463		 * instruction. When not continuing execution, restore the instruction
   464		 * pointer.
   465		 */
   466		if (handled) {
   467			if (regs->ip == addr)
   468				regs->ip += ud_len;
   469		} else {
   470			regs->ip = addr;
   471		}
   472	
   473		if (regs->flags & X86_EFLAGS_IF)
   474			raw_local_irq_disable();
   475		instrumentation_end();
   476	
   477		return handled;
   478	}
   479	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-12 21:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-12 21:17 [peterz-queue:x86/urgent 2/2] arch/x86/kernel/traps.c:400:14: warning: no previous prototype for function 'handle_bug' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox