[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d2f35ee-1b33-40b6-b164-ab4480110e49@linaro.org>
Date: Fri, 9 May 2025 17:35:35 +0200
From: neil.armstrong@...aro.org
To: I Hsin Cheng <richard120310@...il.com>
Cc: maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
tzimmermann@...e.de, airlied@...il.com, simona@...ll.ch,
khilman@...libre.com, jbrunet@...libre.com,
martin.blumenstingl@...glemail.com, christophe.jaillet@...adoo.fr,
skhan@...uxfoundation.org, dri-devel@...ts.freedesktop.org,
linux-amlogic@...ts.infradead.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] drm/meson: Use 1000ULL when operating with mode->clock
On 05/05/2025 20:43, I Hsin Cheng wrote:
> 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@...il.com>
Could you add a Fixes tag ?
Thanks,
Neil
> ---
> Changelog:
>
> v1 -> v2:
> - Use 1000ULL instead of casting the type of "mode->clock"
> - Refine commit title and message
> - Fix the issue for the evaluation inside drm_mode_status
> meson_encoder_hdmi_mode_valid() as well
>
> Christophe,
> Thanks for your review and your suggestion, I think I should add a tag
> for you,too, but I'm not sure what should I add, if you would be so kind
> please let me know how should I tag you in the patch.
>
> Best regards,
> I Hsin Cheng
> ---
> drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
> index 7752d8ac85f0..c08fa93e50a3 100644
> --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c
> @@ -75,7 +75,7 @@ static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder_hdmi,
> unsigned long long venc_freq;
> unsigned long long hdmi_freq;
>
> - vclk_freq = mode->clock * 1000;
> + vclk_freq = mode->clock * 1000ULL;
>
> /* For 420, pixel clock is half unlike venc clock */
> 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
> struct meson_encoder_hdmi *encoder_hdmi = bridge_to_meson_encoder_hdmi(bridge);
> struct meson_drm *priv = encoder_hdmi->priv;
> bool is_hdmi2_sink = display_info->hdmi.scdc.supported;
> - unsigned long long clock = mode->clock * 1000;
> + unsigned long long clock = mode->clock * 1000ULL;
> unsigned long long phy_freq;
> unsigned long long vclk_freq;
> unsigned long long venc_freq;
Powered by blists - more mailing lists