Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2017 09:36:00 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r322532 - stable/11/sys/dev/hwpmc
Message-ID:  <201708150936.v7F9a0CD066451@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Aug 15 09:36:00 2017
New Revision: 322532
URL: https://svnweb.freebsd.org/changeset/base/322532

Log:
  MFC r322256:
  Fix logic error in the the assert, causing the condition to be always true.
  
  PR:	217741

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

Modified: stable/11/sys/dev/hwpmc/hwpmc_piv.c
==============================================================================
--- stable/11/sys/dev/hwpmc/hwpmc_piv.c	Tue Aug 15 09:21:46 2017	(r322531)
+++ stable/11/sys/dev/hwpmc/hwpmc_piv.c	Tue Aug 15 09:36:00 2017	(r322532)
@@ -809,8 +809,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,
@@ -835,8 +835,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708150936.v7F9a0CD066451>