svn commit: r239433 - stable/9/sys/dev/hwpmc

Ed Maste emaste at FreeBSD.org
Mon Aug 20 14:54:31 UTC 2012


Author: emaste
Date: Mon Aug 20 14:54:30 2012
New Revision: 239433
URL: http://svn.freebsd.org/changeset/base/239433

Log:
  MFC r230636:
  
    pmc_*_initialize may return NULL if the CPU is not supported, so check
    that md is not null before dereferencing it.
  
  PR:             kern/156540

Modified:
  stable/9/sys/dev/hwpmc/hwpmc_x86.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/hwpmc/hwpmc_x86.c
==============================================================================
--- stable/9/sys/dev/hwpmc/hwpmc_x86.c	Mon Aug 20 14:52:43 2012	(r239432)
+++ stable/9/sys/dev/hwpmc/hwpmc_x86.c	Mon Aug 20 14:54:30 2012	(r239433)
@@ -252,7 +252,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 = 0; i < md->pmd_nclass; i++) {
 			if (i == PMC_CLASS_INDEX_SOFT)
 				continue;


More information about the svn-src-stable-9 mailing list