Author: kib
Date: Mon Nov 13 09:07:30 2017
New Revision: 325756
URL: https://svnweb.freebsd.org/changeset/base/325756

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

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

Modified: stable/11/sys/dev/hwpmc/hwpmc_mod.c
==============================================================================
--- stable/11/sys/dev/hwpmc/hwpmc_mod.c Mon Nov 13 07:47:43 2017        
(r325755)
+++ stable/11/sys/dev/hwpmc/hwpmc_mod.c Mon Nov 13 09:07:30 2017        
(r325756)
@@ -2578,10 +2578,9 @@ pmc_find_pmc(pmc_id_t pmcid, struct pmc **pmc)
        struct pmc_owner *po;
        struct pmc_process *pp;
 
-       KASSERT(PMC_ID_TO_ROWINDEX(pmcid) < md->pmd_npmc,
-           ("[pmc,%d] Illegal pmc index %d (max %d)", __LINE__,
-               PMC_ID_TO_ROWINDEX(pmcid), md->pmd_npmc));
        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) {
                /*
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to