[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZL62X3/CnsJcWWU4@ashyti-mobl2.lan>
Date: Mon, 24 Jul 2023 19:35:27 +0200
From: Andi Shyti <andi.shyti@...ux.intel.com>
To: Su Hui <suhui@...china.com>
Cc: jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
airlied@...il.com, daniel@...ll.ch, nathan@...nel.org,
ndesaulniers@...gle.com, trix@...hat.com, andrzej.hajda@...el.com,
intel-gfx@...ts.freedesktop.org, llvm@...ts.linux.dev,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org, mripard@...nel.org
Subject: Re: [Intel-gfx] [PATCH v2] drm/i915/tv: avoid possible division by
zero
On Tue, Jul 18, 2023 at 09:32:17AM +0800, Su Hui wrote:
> Clang warning: drivers/gpu/drm/i915/display/intel_tv.c:
> line 991, column 22 Division by zero.
> Assuming tv_mode->oversample=1 and (!tv_mode->progressive)=1,
> then division by zero will happen.
>
> Fixes: 1bba5543e4fe ("drm/i915: Fix TV encoder clock computation")
> Signed-off-by: Su Hui <suhui@...china.com>
> ---
> drivers/gpu/drm/i915/display/intel_tv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
> index 36b479b46b60..f59553f7c132 100644
> --- a/drivers/gpu/drm/i915/display/intel_tv.c
> +++ b/drivers/gpu/drm/i915/display/intel_tv.c
> @@ -988,7 +988,7 @@ intel_tv_mode_to_mode(struct drm_display_mode *mode,
> const struct tv_mode *tv_mode,
> int clock)
> {
> - mode->clock = clock / (tv_mode->oversample >> !tv_mode->progressive);
> + mode->clock = clock / tv_mode->oversample << !tv_mode->progressive;
but this does not provide the same value. Try with:
8 / (2 >> 1)
and
8 / 2 << 1
They are definitely different.
The real check could be:
if (!(tv_mode->oversample >> 1))
return ...
But first I would check if that's actually possible.
Andi
Powered by blists - more mailing lists