]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/irq/32: Use current_stack_pointer to avoid asm() in check_stack_overflow()
authorUros Bizjak <ubizjak@gmail.com>
Mon, 3 Mar 2025 15:54:24 +0000 (16:54 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 4 Mar 2025 19:28:58 +0000 (20:28 +0100)
Make code more readable by using the 'current_stack_pointer' global variable.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250303155446.112769-4-ubizjak@gmail.com
arch/x86/kernel/irq_32.c

index eab458009f9735408f6e147f4bca9a1471791a08..8c7babbcf6b703128f91668a9c56b5f71823c6d2 100644 (file)
@@ -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);
 }