From d6871da33f90d73fee0407a8b40ece48a2dc76e8 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Thu, 27 Oct 2011 13:15:26 -0400 Subject: [PATCH] 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 --- dtrace/profile_dev.c | 4 ++++ 1 file changed, 4 insertions(+) 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); } -- 2.50.1