From: Uros Bizjak Date: Mon, 3 Mar 2025 15:54:24 +0000 (+0100) Subject: x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d4432fb5b8798a7663974bed277a8a6e330a50d8;p=users%2Fjedix%2Flinux-maple.git x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow() Make code more readable by using the 'current_stack_pointer' global variable. Signed-off-by: Uros Bizjak Signed-off-by: Ingo Molnar Cc: Andy Lutomirski Cc: Brian Gerst Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Link: https://lore.kernel.org/r/20250303155446.112769-4-ubizjak@gmail.com --- diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index eab458009f97..8c7babbcf6b7 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c @@ -31,10 +31,7 @@ int sysctl_panic_on_stackoverflow __read_mostly; /* Debugging check for stack overflow: is there less than 1KB free? */ static int check_stack_overflow(void) { - long sp; - - __asm__ __volatile__("andl %%esp,%0" : - "=r" (sp) : "0" (THREAD_SIZE - 1)); + unsigned long sp = current_stack_pointer & (THREAD_SIZE - 1); return sp < (sizeof(struct thread_info) + STACK_WARN); }