Skip to content

Commit 13408c6

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/traps: Use current_top_of_stack() helper in traps.c
Use current_top_of_stack() helper in sync_regs() and vc_switch_off_ist() instead of open-coding the reading of the top_of_stack percpu variable explicitly. Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20231204210320.114429-2-ubizjak@gmail.com
1 parent 0e37036 commit 13408c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kernel/traps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ DEFINE_IDTENTRY_RAW(exc_int3)
772772
*/
773773
asmlinkage __visible noinstr struct pt_regs *sync_regs(struct pt_regs *eregs)
774774
{
775-
struct pt_regs *regs = (struct pt_regs *)this_cpu_read(pcpu_hot.top_of_stack) - 1;
775+
struct pt_regs *regs = (struct pt_regs *)current_top_of_stack() - 1;
776776
if (regs != eregs)
777777
*regs = *eregs;
778778
return regs;
@@ -790,7 +790,7 @@ asmlinkage __visible noinstr struct pt_regs *vc_switch_off_ist(struct pt_regs *r
790790
* trust it and switch to the current kernel stack
791791
*/
792792
if (ip_within_syscall_gap(regs)) {
793-
sp = this_cpu_read(pcpu_hot.top_of_stack);
793+
sp = current_top_of_stack();
794794
goto sync;
795795
}
796796

0 commit comments

Comments
 (0)