Skip to content

Commit eb0851e

Browse files
vax-rsuperna9999
authored andcommitted
drm/meson: Use 1000ULL when operating with mode->clock
Coverity scan reported the usage of "mode->clock * 1000" may lead to integer overflow. Use "1000ULL" instead of "1000" when utilizing it to avoid potential integer overflow issue. Link: https://scan5.scan.coverity.com/#/project-view/10074/10063?selectedIssue=1646759 Signed-off-by: I Hsin Cheng <richard120310@gmail.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Fixes: 1017560 ("drm/meson: use unsigned long long / Hz for frequency types") Link: https://lore.kernel.org/r/20250505184338.678540-1-richard120310@gmail.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
1 parent 7c6fa17 commit eb0851e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gpu/drm/meson/meson_encoder_hdmi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder_hdmi,
7575
unsigned long long venc_freq;
7676
unsigned long long hdmi_freq;
7777

78-
vclk_freq = mode->clock * 1000;
78+
vclk_freq = mode->clock * 1000ULL;
7979

8080
/* For 420, pixel clock is half unlike venc clock */
8181
if (encoder_hdmi->output_bus_fmt == MEDIA_BUS_FMT_UYYVYY8_0_5X24)
@@ -123,7 +123,7 @@ static enum drm_mode_status meson_encoder_hdmi_mode_valid(struct drm_bridge *bri
123123
struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);
124124
struct meson_drm *priv = encoder_hdmi->priv;
125125
bool is_hdmi2_sink = display_info->hdmi.scdc.supported;
126-
unsigned long long clock = mode->clock * 1000;
126+
unsigned long long clock = mode->clock * 1000ULL;
127127
unsigned long long phy_freq;
128128
unsigned long long vclk_freq;
129129
unsigned long long venc_freq;

0 commit comments

Comments
 (0)