]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Handle the case where regs (during cyclic processing) is NULL. This indicates
authorKris Van Hees <kris.van.hees@oracle.com>
Thu, 27 Oct 2011 17:15:26 +0000 (13:15 -0400)
committerKris Van Hees <kris.van.hees@oracle.com>
Thu, 27 Oct 2011 17:15:26 +0000 (13:15 -0400)
a bug but with this code change we'll survive that case and simply not have
meaningful PC and UPC values as argument to the probe, which is better than a
full scale OOPS due to NULL pointer dereference.

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
dtrace/profile_dev.c

index e66a77f258cb216dca1c4fd1591eb5918696fb7f..ee7956be8348d965f4ffdcd1c09cafb98d1ca48d 100644 (file)
@@ -90,10 +90,12 @@ static void profile_tick(void *arg)
        struct pt_regs  *regs = get_irq_regs();
        unsigned long   pc = 0, upc = 0;
 
+if (regs) {
        if (user_mode(regs))
                upc = GET_IP(regs);
        else
                pc = GET_IP(regs);
+}
 
        dtrace_probe(prof->prof_id, pc, upc, 0, 0, 0);
 }
@@ -110,10 +112,12 @@ static void profile_prof(void *arg)
        pcpu->profc_expected = ktime_add(pcpu->profc_expected,
                                         pcpu->profc_interval);
 
+if (regs) {
        if (user_mode(regs))
                upc = GET_IP(regs);
        else
                pc = GET_IP(regs);
+}
 
        dtrace_probe(prof->prof_id, pc, upc, ktime_to_ns(late), 0, 0);
 }