linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Coverity: dcn20_update_bounding_box(): UNINTENDED_INTEGER_DIVISION
@ 2019-11-04 17:40 coverity-bot
  0 siblings, 0 replies; only message in thread
From: coverity-bot @ 2019-11-04 17:40 UTC (permalink / raw)
  To: Jun Lei; +Cc: Leo Li, Alex Deucher, Tony Cheng, Gustavo A. R. Silva, linux-next

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20191031 as part of the linux-next weekly 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 recent commits:

f18bc4e53ad6 ("drm/amd/display: update calculated bounding box logic for NV")

Coverity reported the following:

*** CID 1487397:    (UNINTENDED_INTEGER_DIVISION)
/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c: 3142 in dcn20_update_bounding_box()
3136     		// FCLK:UCLK ratio is 1.08
3137     		min_fclk_required_by_uclk = mul_u64_u32_shr(BIT_ULL(32) * 1080 / 1000000, uclk_states[i], 32);
3138
3139     		calculated_states[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?
3140     				min_dcfclk : min_fclk_required_by_uclk;
3141
vvv     CID 1487397:    (UNINTENDED_INTEGER_DIVISION)
vvv     Dividing integer expressions "max_clocks->socClockInKhz" and "1000U", and then converting the integer quotient to type "double". Any remainder, or fractional part of the quotient, is ignored.
3142     		calculated_states[i].socclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?
3143     				max_clocks->socClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;
3144
3145     		calculated_states[i].dcfclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?
3146     				max_clocks->dcfClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;
3147
/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c: 3145 in dcn20_update_bounding_box()
3139     		calculated_states[i].fabricclk_mhz = (min_fclk_required_by_uclk < min_dcfclk) ?
3140     				min_dcfclk : min_fclk_required_by_uclk;
3141
3142     		calculated_states[i].socclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->socClockInKhz / 1000) ?
3143     				max_clocks->socClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;
3144
vvv     CID 1487397:    (UNINTENDED_INTEGER_DIVISION)
vvv     Dividing integer expressions "max_clocks->dcfClockInKhz" and "1000U", and then converting the integer quotient to type "double". Any remainder, or fractional part of the quotient, is ignored.
3145     		calculated_states[i].dcfclk_mhz = (calculated_states[i].fabricclk_mhz > max_clocks->dcfClockInKhz / 1000) ?
3146     				max_clocks->dcfClockInKhz / 1000 : calculated_states[i].fabricclk_mhz;
3147
3148     		calculated_states[i].dispclk_mhz = max_clocks->displayClockInKhz / 1000;
3149     		calculated_states[i].dppclk_mhz = max_clocks->displayClockInKhz / 1000;
3150     		calculated_states[i].dscclk_mhz = max_clocks->displayClockInKhz / (1000 * 3);

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):

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1487397 ("UNINTENDED_INTEGER_DIVISION")
Fixes: f18bc4e53ad6 ("drm/amd/display: update calculated bounding box logic for NV")


Thanks for your attention!

-- 
Coverity-bot

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

only message in thread, other threads:[~2019-11-04 17:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 17:40 Coverity: dcn20_update_bounding_box(): UNINTENDED_INTEGER_DIVISION 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).