summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2012-01-28 01:38:48 +0000
committeremaste <emaste@FreeBSD.org>2012-01-28 01:38:48 +0000
commitca620d68ac302a25017c571623961a50d251a780 (patch)
treeac378c7ffed565fd0443ccca68f246c5ed8644b8
parentbe60b495b269cc7cfbca1778a4ef8f491b311726 (diff)
downloadFreeBSD-src-ca620d68ac302a25017c571623961a50d251a780.zip
FreeBSD-src-ca620d68ac302a25017c571623961a50d251a780.tar.gz
pmc_*_initialize may return NULL if the CPU is not supported, so check
that md is not null before dereferencing it. PR: kern/156540
-rw-r--r--sys/dev/hwpmc/hwpmc_x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/hwpmc/hwpmc_x86.c b/sys/dev/hwpmc/hwpmc_x86.c
index 8c98983..72ed518 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;
OpenPOWER on IntegriCloud