Print this page
10093 kmem_log_enter() dereferences pointer before NULL check

*** 1423,1437 **** static void * kmem_log_enter(kmem_log_header_t *lhp, void *data, size_t size) { void *logspace; ! kmem_cpu_log_header_t *clhp = &lhp->lh_cpu[CPU->cpu_seqid]; if (lhp == NULL || kmem_logging == 0 || panicstr) return (NULL); mutex_enter(&clhp->clh_lock); clhp->clh_hits++; if (size > clhp->clh_avail) { mutex_enter(&lhp->lh_lock); lhp->lh_hits++; --- 1423,1439 ---- static void * kmem_log_enter(kmem_log_header_t *lhp, void *data, size_t size) { void *logspace; ! kmem_cpu_log_header_t *clhp; if (lhp == NULL || kmem_logging == 0 || panicstr) return (NULL); + clhp = &lhp->lh_cpu[CPU->cpu_seqid]; + mutex_enter(&clhp->clh_lock); clhp->clh_hits++; if (size > clhp->clh_avail) { mutex_enter(&lhp->lh_lock); lhp->lh_hits++;