Bug 217741 - sys/dev/hwpmc/hwpmc_piv.c: PVS-Studio: V547
Summary: sys/dev/hwpmc/hwpmc_piv.c: PVS-Studio: V547
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Konstantin Belousov
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-03-13 11:42 UTC by Svyatoslav
Modified: 2017-08-24 14:17 UTC (History)
2 users (show)

See Also:


Attachments
git patch (756 bytes, patch)
2017-03-13 11:42 UTC, Svyatoslav
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.