svn commit: r325757 - stable/10/sys/dev/hwpmc

Konstantin Belousov kib at FreeBSD.org
Mon Nov 13 09:10:18 UTC 2017


Author: kib
Date: Mon Nov 13 09:10:17 2017
New Revision: 325757
URL: https://svnweb.freebsd.org/changeset/base/325757

Log:
  MFC r325671:
  Check that the pmc index is less than the number of hardware PMCs,
  instead of asserting the condition.

Modified:
  stable/10/sys/dev/hwpmc/hwpmc_mod.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_mod.c	Mon Nov 13 09:07:30 2017	(r325756)
+++ stable/10/sys/dev/hwpmc/hwpmc_mod.c	Mon Nov 13 09:10:17 2017	(r325757)
@@ -2583,6 +2583,8 @@ pmc_find_pmc(pmc_id_t pmcid, struct pmc **pmc)
 	struct pmc_owner *po;
 
 	PMCDBG1(PMC,FND,1, "find-pmc id=%d", pmcid);
+	if (PMC_ID_TO_ROWINDEX(pmcid) >= md->pmd_npmc)
+		return (EINVAL);
 
 	if ((po = pmc_find_owner_descriptor(curthread->td_proc)) == NULL)
 		return ESRCH;


More information about the svn-src-stable mailing list