Bug 217783 - sys/dev/cyapa/cyapa.c: PVS-Studio: V778 Two similar code fragments were found. Perhaps, this is a typo and 'cap_resy' variable should be used instead of 'cap_resx'.
Summary: sys/dev/cyapa/cyapa.c: PVS-Studio: V778 Two similar code fragments were found...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2017-03-14 13:29 UTC by Svyatoslav
Modified: 2017-08-08 13:28 UTC (History)
2 users (show)

See Also:


Attachments
git patch (522 bytes, patch)
2017-03-14 13:29 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-14 13:29:26 UTC
Created attachment 180816 [details]
git patch

We have found and fixed a bug 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: V778 Two similar code fragments were found. Perhaps, this is a typo and 'cap_resy' variable should be used instead of 'cap_resx'. cyapa.c 1458
Comment 1 Michael Gmelin freebsd_committer 2017-08-08 13:22:20 UTC
Looks reasonable
Comment 2 Michael Gmelin freebsd_committer 2017-08-08 13:28:11 UTC
Fixed in current, thank you for providing the patch. Will MFC to 11 as well.
Comment 3 commit-hook freebsd_committer 2017-08-08 13:28:17 UTC
A commit references this bug:

Author: grembo
Date: Tue Aug  8 13:27:32 UTC 2017
New revision: 322253
URL: https://svnweb.freebsd.org/changeset/base/322253

Log:
  Fix typo in cyapa out of bounds check.

  PR:		217783
  Submitted by:	razmyslov@viva64.com
  MFC after:	1 week

Changes:
  head/sys/dev/cyapa/cyapa.c