From: Kris Van Hees Date: Thu, 27 Oct 2011 17:15:26 +0000 (-0400) Subject: Handle the case where regs (during cyclic processing) is NULL. This indicates X-Git-Tag: v4.1.12-111.0.20170907_2225~3^2~3^2~209 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=d6871da33f90d73fee0407a8b40ece48a2dc76e8;p=users%2Fjedix%2Flinux-maple.git Handle the case where regs (during cyclic processing) is NULL. This indicates 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 --- diff --git a/dtrace/profile_dev.c b/dtrace/profile_dev.c index e66a77f258cb..ee7956be8348 100644 --- a/dtrace/profile_dev.c +++ b/dtrace/profile_dev.c @@ -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); }