powerpc: Use the TRAP macro whenever comparing a trap number
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 12 Jan 2018 02:28:49 +0000 (13:28 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 16 Jan 2018 12:51:43 +0000 (23:51 +1100)
Trap numbers can have extra bits at the bottom that need to
be filtered out. There are a few cases where we don't do that.

It's possible that we got lucky but better safe than sorry.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/process.c
arch/powerpc/kernel/traps.c
arch/powerpc/mm/fault.c

index 5acb5a176dbe5c8bffe6ddb7458b7d3ac2b7019f..bcd4441304a546ccba31f51729c769e9eaef8030 100644 (file)
@@ -1409,7 +1409,7 @@ void show_regs(struct pt_regs * regs)
        print_msr_bits(regs->msr);
        pr_cont("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
        trap = TRAP(regs);
-       if ((regs->trap != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
+       if ((TRAP(regs) != 0xc00) && cpu_has_feature(CPU_FTR_CFAR))
                pr_cont("CFAR: "REG" ", regs->orig_gpr3);
        if (trap == 0x200 || trap == 0x300 || trap == 0x600)
 #if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
index f3eb61be0d30f07434119bb5c07fe82fb88b06ae..d61989be28e1acd8b5bbaf7c93c51e84a46eeb72 100644 (file)
@@ -1564,7 +1564,7 @@ void facility_unavailable_exception(struct pt_regs *regs)
        u8 status;
        bool hv;
 
-       hv = (regs->trap == 0xf80);
+       hv = (TRAP(regs) == 0xf80);
        if (hv)
                value = mfspr(SPRN_HFSCR);
        else
index 4797d08581cec347b6cf34a316c1ef585209653c..c07896c1951768eb2c0489a82a172978a48f2b19 100644 (file)
@@ -571,7 +571,7 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
 
        /* kernel has accessed a bad area */
 
-       switch (regs->trap) {
+       switch (TRAP(regs)) {
        case 0x300:
        case 0x380:
                printk(KERN_ALERT "Unable to handle kernel paging request for "