Coverity: build_vrr_infopacket_data_v3(): Incorrect expression
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.
Addresses-Coverity-ID: 1492712 ("Incorrect expression")
Thanks for your attention!
Signature · 1 line
Coverity-bot