public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: coverity-bot <keescook@chromium.org>
To: Haiyi Zhou <haiyi.zhou@amd.com>
Cc: Anthony Koo <Anthony.Koo@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org
Subject: Coverity: build_vrr_infopacket_data_v3(): Incorrect expression
Date: Thu, 23 Apr 2020 12:17:10 -0700	[thread overview]
Message-ID: <202004231216.E46C13E8@keescook> (raw)

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20200423 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Fri Apr 3 10:00:58 2020 -0400
    d2bacc38f6ca ("drm/amd/display: Change infopacket type programming")

Coverity reported the following:

*** CID 1492712:  Incorrect expression  (COPY_PASTE_ERROR)
/drivers/gpu/drm/amd/display/modules/freesync/freesync.c: 586 in build_vrr_infopacket_data_v3()
580     		/* PB8 = FreeSync Maximum refresh rate (Hz) */
581     		infopacket->sb[8] = (unsigned char)((vrr->fixed_refresh_in_uhz + 500000) / 1000000);
582     	} else if (vrr->state == VRR_STATE_ACTIVE_VARIABLE) {
583     		/* PB7 = FreeSync Minimum refresh rate (Hz) */
584     		infopacket->sb[7] = (unsigned char)((vrr->min_refresh_in_uhz + 500000) / 1000000);
585     		/* PB8 = FreeSync Maximum refresh rate (Hz) */
vvv     CID 1492712:  Incorrect expression  (COPY_PASTE_ERROR)
vvv     "max_refresh_in_uhz" in "vrr->max_refresh_in_uhz" looks like a copy-paste error.
VVV     Should it be "min_refresh_in_uhz" instead?
586     		infopacket->sb[8] = (unsigned char)((vrr->max_refresh_in_uhz + 500000) / 1000000);
587     	} else {
588     		// Non-fs case, program nominal range
589     		/* PB7 = FreeSync Minimum refresh rate (Hz) */
590     		infopacket->sb[7] = (unsigned char)((vrr->max_refresh_in_uhz + 500000) / 1000000);
591     		/* PB8 = FreeSync Maximum refresh rate (Hz) */

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Human edit:
Given how the pattern is fixed/fixed, max/max, it seems likely the
middle would be min/min, but is max/min. No clue what's actually correct
here, though.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1492712 ("Incorrect expression")
Fixes: d2bacc38f6ca ("drm/amd/display: Change infopacket type programming")

Thanks for your attention!

-- 
Coverity-bot

                 reply	other threads:[~2020-04-23 19:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202004231216.E46C13E8@keescook \
    --to=keescook@chromium.org \
    --cc=Anthony.Koo@amd.com \
    --cc=Rodrigo.Siqueira@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=gustavo@embeddedor.com \
    --cc=haiyi.zhou@amd.com \
    --cc=linux-next@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox