Commit c75e59e4 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Geert Uytterhoeven

m68k: Use get_kernel_nofault() in show_registers()

Use the proper get_kernel_nofault() helper to access an unsafe kernel
pointer without faulting instead of playing with set_fs() and
get_user().
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20200720114314.196686-1-hch@lst.deSigned-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
parent ea2abe2f
......@@ -845,7 +845,6 @@ static void show_trace(unsigned long *stack, const char *loglvl)
void show_registers(struct pt_regs *regs)
{
struct frame *fp = (struct frame *)regs;
mm_segment_t old_fs = get_fs();
u16 c, *cp;
unsigned long addr;
int i;
......@@ -918,10 +917,9 @@ void show_registers(struct pt_regs *regs)
show_stack(NULL, (unsigned long *)addr, KERN_INFO);
pr_info("Code:");
set_fs(KERNEL_DS);
cp = (u16 *)regs->pc;
for (i = -8; i < 16; i++) {
if (get_user(c, cp + i) && i >= 0) {
if (get_kernel_nofault(c, cp + i) && i >= 0) {
pr_cont(" Bad PC value.");
break;
}
......@@ -930,7 +928,6 @@ void show_registers(struct pt_regs *regs)
else
pr_cont(" <%04x>", c);
}
set_fs(old_fs);
pr_cont("\n");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment