Commit 5f940e52 authored by Saud Farooqui's avatar Saud Farooqui Committed by Maxime Ripard

drm/vc4: hdmi: Fixed possible integer overflow

Multiplying ints and saving it in unsigned long long
could lead to integer overflow before being type casted to
unsigned long long.

Addresses-Coverity:  1505113: Unintentional integer overflow.
Signed-off-by: default avatarSaud Farooqui <farooqui_saud@hotmail.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/PA4P189MB1421E63C0FF3EBF234A80AB38BA79@PA4P189MB1421.EURP189.PROD.OUTLOOK.COM
parent be33d52e
...@@ -1481,7 +1481,7 @@ vc4_hdmi_encoder_compute_mode_clock(const struct drm_display_mode *mode, ...@@ -1481,7 +1481,7 @@ vc4_hdmi_encoder_compute_mode_clock(const struct drm_display_mode *mode,
unsigned int bpc, unsigned int bpc,
enum vc4_hdmi_output_format fmt) enum vc4_hdmi_output_format fmt)
{ {
unsigned long long clock = mode->clock * 1000; unsigned long long clock = mode->clock * 1000ULL;
if (mode->flags & DRM_MODE_FLAG_DBLCLK) if (mode->flags & DRM_MODE_FLAG_DBLCLK)
clock = clock * 2; clock = clock * 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment