drm: Use u64 for intermediate dotclock calculations
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 21 Oct 2016 14:15:40 +0000 (15:15 +0100)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 15 Aug 2018 01:57:24 +0000 (18:57 -0700)
commit2313328ba4abe94493a06f3b16b5674639777983
tree1d4af8b01ca40e94dd31986b305537b89336b889
parent40d3357b7b2a91333da05075e225480aee2f1b42
drm: Use u64 for intermediate dotclock calculations

We have reached the era where monitor bandwidths now exceed 31bits in
frequency calculations, though as we stored them in kHz units we are
safe from overflow in the modelines for some time.

[   48.723720] UBSAN: Undefined behaviour in ../drivers/gpu/drm/drm_modes.c:325:49
[   48.726943] signed integer overflow:
[   48.728503] 2240 * 1000000 cannot be represented in type 'int'

Change-Id: Ib0ab1c82e0f5fb9d11244a5dbc53b565e1179127
Reported-by: Martin Liška <marxin.liska@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98372
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161021141540.26837-1-chris@chris-wilson.co.uk
drivers/gpu/drm/drm_modes.c