Bug 217741

Summary: sys/dev/hwpmc/hwpmc_piv.c: PVS-Studio: V547
Product: Base System Reporter: Svyatoslav <razmyslov>
Component: kernAssignee: Konstantin Belousov <kib>
Status: Closed FIXED    
Severity: Affects Many People CC: emaste, kib
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
git patch none

Description Svyatoslav 2017-03-13 11:42:23 UTC
Created attachment 180765 [details]
git patch

We have found and fixed bugs using PVS-Studio tool. PVS-Studio is a static code analyzer for C, C++ and C#: https://www.viva64.com/en/pvs-studio/

Analyzer warning:
V547 Expression 'cfgflags >= 0 || cfgflags <= 3' is always true. hwpmc_piv.c 812
V547 Expression 'cfgflags >= 0 || cfgflags <= 3' is always true. hwpmc_piv.c 838
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-08-08 15:47:08 UTC
A commit references this bug:

Author: kib
Date: Tue Aug  8 15:46:30 UTC 2017
New revision: 322256
URL: https://svnweb.freebsd.org/changeset/base/322256

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

  Also improve the formatting of the corresponding KASSERT message.

  Based on the submission by:	Svyatoslav <razmyslov@viva64.com>
  Found by:	PVS-Studio
  PR:	217741
  Reviewed by:	emaste
  Sponsored by:	The FreeBSD Foundation (kib)
  MFC after:	1 week

Changes:
  head/sys/dev/hwpmc/hwpmc_piv.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-08-15 09:36:27 UTC
A commit references this bug:

Author: kib
Date: Tue Aug 15 09:36:01 UTC 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

Changes:
_U  stable/11/
  stable/11/sys/dev/hwpmc/hwpmc_piv.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-08-15 14:22:24 UTC
A commit references this bug:

Author: kib
Date: Tue Aug 15 14:21:44 UTC 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)

Changes:
_U  stable/10/
  stable/10/sys/dev/hwpmc/hwpmc_piv.c
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2017-08-24 14:17:50 UTC
MFCed Tue Aug 15 14:21:44 UTC 2017.