Fixes bug in spinlock_debug
authorBarret Rhoden <brho@cs.berkeley.edu>
Tue, 24 Aug 2010 22:14:03 +0000 (15:14 -0700)
committerKevin Klues <klueska@cs.berkeley.edu>
Thu, 3 Nov 2011 00:35:53 +0000 (17:35 -0700)
It's possible to call procinfo on a process that never ran (and thus
never set a call-site).

kern/arch/i686/cpuinfo.c

index 61ec777..a9fcef3 100644 (file)
@@ -191,6 +191,10 @@ void spinlock_debug(spinlock_t *lock)
        char buf[256];
        uint32_t eip = (uint32_t)lock->call_site;
 
+       if (!eip) {
+               printk("Lock %p: never locked\n", lock);
+               return;
+       }
        debuginfo_eip(eip, &debuginfo);
        memset(buf, 0, 256);
        strncpy(buf, debuginfo.eip_fn_name, MIN(debuginfo.eip_fn_namelen, 256));