Skip to content

Commit 00ae36d

Browse files
antonblanchardpaulusmack
authored andcommitted
[POWERPC] Better check in show_instructions
Instead of just checking that an address is in the right range, use the provided __kernel_text_address() helper which covers both the kernel and module text sections. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
1 parent 99f4861 commit 00ae36d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

arch/powerpc/kernel/process.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,6 @@ struct task_struct *__switch_to(struct task_struct *prev,
341341

342342
static int instructions_to_print = 16;
343343

344-
#ifdef CONFIG_PPC64
345-
#define BAD_PC(pc) ((REGION_ID(pc) != KERNEL_REGION_ID) && \
346-
(REGION_ID(pc) != VMALLOC_REGION_ID))
347-
#else
348-
#define BAD_PC(pc) ((pc) < KERNELBASE)
349-
#endif
350-
351344
static void show_instructions(struct pt_regs *regs)
352345
{
353346
int i;
@@ -366,7 +359,8 @@ static void show_instructions(struct pt_regs *regs)
366359
* bad address because the pc *should* only be a
367360
* kernel address.
368361
*/
369-
if (BAD_PC(pc) || __get_user(instr, (unsigned int __user *)pc)) {
362+
if (!__kernel_text_address(pc) ||
363+
__get_user(instr, (unsigned int __user *)pc)) {
370364
printk("XXXXXXXX ");
371365
} else {
372366
if (regs->nip == pc)

0 commit comments

Comments
 (0)