linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Coverity: build_vrr_infopacket_data_v3(): Incorrect expression
@ 2020-04-23 19:17 coverity-bot
  0 siblings, 0 replies; only message in thread
From: coverity-bot @ 2020-04-23 19:17 UTC (permalink / raw)
  To: Haiyi Zhou
  Cc: Anthony Koo, Alex Deucher, Rodrigo Siqueira, Gustavo A. R. Silva,
	linux-next

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-23 19:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 19:17 Coverity: build_vrr_infopacket_data_v3(): Incorrect expression coverity-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).