Skip to contentSkip to conversation

Coverity: dispc_vp_mode_valid(): Integer handling issues

DISCUSSION coverity-bot 1 participant 1 message Apr 13, 2020 Linux-next tree

lore
Share & tools
lore
#0 lore raw

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

Addresses-Coverity-ID: 1461667 ("Integer handling issues")

Fixes 32a1795f57ee ("drm/tidss: New driver for TI Keystone platform Display SubSystem")

Thanks for your attention!

Signature · 1 line
Coverity-bot