public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* Coverity: dispc_vp_mode_valid(): Integer handling issues
@ 2020-04-13 16:15 coverity-bot
  0 siblings, 0 replies; only message in thread
From: coverity-bot @ 2020-04-13 16:15 UTC (permalink / raw)
  To: Jyri Sarha
  Cc: Benoit Parrot, Sam Ravnborg, Tomi Valkeinen, Gustavo A. R. Silva,
	linux-next

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20200413 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 commits:

  Fri Nov 8 09:45:28 2019 +0200
    32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")

Coverity reported the following:

*** CID 1461667:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/drivers/gpu/drm/tidss/tidss_dispc.c: 1175 in dispc_vp_mode_valid()
1169     		return MODE_BAD_VVALUE;
1170
1171     	if (dispc->memory_bandwidth_limit) {
1172     		const unsigned int bpp = 4;
1173     		u64 bandwidth;
1174
vvv     CID 1461667:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
vvv     Potentially overflowing expression "1000 * mode->clock" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "u64" (64 bits, unsigned).
1175     		bandwidth = 1000 * mode->clock;
1176     		bandwidth = bandwidth * mode->hdisplay * mode->vdisplay * bpp;
1177     		bandwidth = div_u64(bandwidth, mode->htotal * mode->vtotal);
1178
1179     		if (dispc->memory_bandwidth_limit < bandwidth)
1180     			return MODE_BAD;

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: 1461667 ("Integer handling issues")
Fixes: 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")

Thanks for your attention!

-- 
Coverity-bot

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

only message in thread, other threads:[~2020-04-13 16:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13 16:15 Coverity: dispc_vp_mode_valid(): Integer handling issues coverity-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox