Skip to content

Commit 5a8ff54

Browse files
jpoimboeingomolnar
authored andcommitted
x86/dumpstack: Remove unnecessary stack pointer arguments
When calling show_stack_log_lvl() or dump_trace() with a regs argument, providing a stack pointer or frame pointer is redundant. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>d Reviewed-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Brian Gerst <brgerst@gmail.com> Cc: Byungchul Park <byungchul.park@lge.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Nilay Vaish <nilayvaish@gmail.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1694e2e955e3b9a73a3c3d5ba2634344014dd550.1472057064.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 4b8afaf commit 5a8ff54

4 files changed

Lines changed: 4 additions & 10 deletions

File tree

‎arch/x86/kernel/dumpstack.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ void show_stack(struct task_struct *task, unsigned long *sp)
185185

186186
void show_stack_regs(struct pt_regs *regs)
187187
{
188-
show_stack_log_lvl(current, regs, (unsigned long *)regs->sp, regs->bp, "");
188+
show_stack_log_lvl(current, regs, NULL, 0, "");
189189
}
190190

191191
static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;

‎arch/x86/kernel/dumpstack_32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void show_regs(struct pt_regs *regs)
122122
u8 *ip;
123123

124124
pr_emerg("Stack:\n");
125-
show_stack_log_lvl(NULL, regs, &regs->sp, 0, KERN_EMERG);
125+
show_stack_log_lvl(NULL, regs, NULL, 0, KERN_EMERG);
126126

127127
pr_emerg("Code:");
128128

‎arch/x86/kernel/dumpstack_64.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,7 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
283283
void show_regs(struct pt_regs *regs)
284284
{
285285
int i;
286-
unsigned long sp;
287286

288-
sp = regs->sp;
289287
show_regs_print_info(KERN_DEFAULT);
290288
__show_regs(regs, 1);
291289

@@ -300,8 +298,7 @@ void show_regs(struct pt_regs *regs)
300298
u8 *ip;
301299

302300
printk(KERN_DEFAULT "Stack:\n");
303-
show_stack_log_lvl(NULL, regs, (unsigned long *)sp,
304-
0, KERN_DEFAULT);
301+
show_stack_log_lvl(NULL, regs, NULL, 0, KERN_DEFAULT);
305302

306303
printk(KERN_DEFAULT "Code: ");
307304

‎arch/x86/oprofile/backtrace.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,14 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
113113
struct stack_frame *head = (struct stack_frame *)frame_pointer(regs);
114114

115115
if (!user_mode(regs)) {
116-
unsigned long stack = kernel_stack_pointer(regs);
117-
118116
if (!depth)
119117
return;
120118

121119
oprofile_add_trace(regs->ip);
122120
if (!--depth)
123121
return;
124122

125-
dump_trace(NULL, regs, (unsigned long *)stack, 0,
126-
&backtrace_ops, &depth);
123+
dump_trace(NULL, regs, NULL, 0, &backtrace_ops, &depth);
127124
return;
128125
}
129126

0 commit comments

Comments
 (0)