From 158c4475c832b60f103b1f612b7ce43674ebd298 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Sat, 28 Jan 2012 01:38:48 +0000 Subject: [PATCH] pmc_*_initialize may return NULL if the CPU is not supported, so check that md is not null before dereferencing it. PR: kern/156540 --- sys/dev/hwpmc/hwpmc_x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c index 8c98983b571d..72ed518f1a2d 100644 --- a/sys/dev/hwpmc/hwpmc_x86.c +++ b/sys/dev/hwpmc/hwpmc_x86.c @@ -250,7 +250,7 @@ pmc_md_initialize() return (NULL); /* disallow sampling if we do not have an LAPIC */ - if (!lapic_enable_pmc()) + if (md != NULL && !lapic_enable_pmc()) for (i = 1; i < md->pmd_nclass; i++) md->pmd_classdep[i].pcd_caps &= ~PMC_CAP_INTERRUPT;