Author: kib
Date: Tue Aug 15 14:21:44 2017
New Revision: 322543
URL: https://svnweb.freebsd.org/changeset/base/322543

Log:
  MFC r322256:
  Fix logic error in the the assert, causing the condition to be always true.
  
  PR:   217741
  Approved by:  re (gjb)

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

Modified: stable/10/sys/dev/hwpmc/hwpmc_piv.c
==============================================================================
--- stable/10/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 15 14:03:26 2017        
(r322542)
+++ stable/10/sys/dev/hwpmc/hwpmc_piv.c Tue Aug 15 14:21:44 2017        
(r322543)
@@ -812,8 +812,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
        mtx_lock_spin(&pc->pc_mtx);
        cfgflags = P4_PCPU_GET_CFGFLAGS(pc,ri);
 
-       KASSERT(cfgflags >= 0 || cfgflags <= 3,
-           ("[p4,%d] illegal cfgflags cfg=%d on cpu=%d ri=%d", __LINE__,
+       KASSERT((cfgflags & ~0x3) == 0,
+           ("[p4,%d] illegal cfgflags cfg=%#x on cpu=%d ri=%d", __LINE__,
                cfgflags, cpu, ri));
 
        KASSERT(cfgflags == 0 || phw->phw_pmc,
@@ -838,8 +838,8 @@ p4_config_pmc(int cpu, int ri, struct pmc *pm)
                        phw->phw_pmc = NULL;
        }
 
-       KASSERT(cfgflags >= 0 || cfgflags <= 3,
-           ("[p4,%d] illegal runcount cfg=%d on cpu=%d ri=%d", __LINE__,
+       KASSERT((cfgflags & ~0x3) == 0,
+           ("[p4,%d] illegal runcount cfg=%#x on cpu=%d ri=%d", __LINE__,
                cfgflags, cpu, ri));
 
        P4_PCPU_SET_CFGFLAGS(pc,ri,cfgflags);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "[email protected]"

Reply via email to