[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20211210172505.vdjhyvawwvte3lp7@ldmartin-desk2>
Date: Fri, 10 Dec 2021 09:25:05 -0800
From: Lucas De Marchi <lucas.demarchi@...el.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc: dri-devel@...ts.freedesktop.org,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
Anusha Srivatsa <anusha.srivatsa@...el.com>,
David Airlie <airlied@...ux.ie>,
intel-gfx@...ts.freedesktop.org, kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org,
Chris Wilson <chris@...is-wilson.co.uk>,
José Roberto de Souza <jose.souza@...el.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>, dan.carpenter@...cle.com
Subject: Re: [PATCH] drm: i915: display: intel_dmc: Fixes an unsigned
subtraction which can never be negative.
On Thu, Dec 09, 2021 at 08:41:24PM -0800, Harshit Mogalapalli wrote:
>smatch warning:
>drivers/gpu/drm/i915/display/intel_dmc.c:601 parse_dmc_fw() warn:
>unsigned 'fw->size - offset' is never less than zero
>
>Firmware size is size_t and offset is u32. So the subtraction is
>unsigned which can never be less than zero.
>
>Fixes: 3d5928a168a9 ("drm/i915/xelpd: Pipe A DMC plugging")
>Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@...el.com>
"s|drm: i915: display: Fixes|drm/i915/display: Fix|" in the subject,
that I will do when applying after we have the CI results.
thanks
Lucas De Marchi
>---
> drivers/gpu/drm/i915/display/intel_dmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>index 0cab18f972d1..2f477c298b00 100644
>--- a/drivers/gpu/drm/i915/display/intel_dmc.c
>+++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>@@ -598,7 +598,7 @@ static void parse_dmc_fw(struct drm_i915_private *dev_priv,
> continue;
>
> offset = readcount + dmc->dmc_info[id].dmc_offset * 4;
>- if (fw->size - offset < 0) {
>+ if (offset > fw->size) {
> drm_err(&dev_priv->drm, "Reading beyond the fw_size\n");
> continue;
> }
>--
>2.27.0
>
Powered by blists - more mailing lists