[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOCk7Nr9r3Spnvh9_CO2rh8vTAP3hHOXjBO=5oGS4CyS4hhNrQ@mail.gmail.com>
Date: Mon, 3 Jun 2019 08:56:33 -0600
From: Jeffrey Hugo <jeffrey.l.hugo@...il.com>
To: Jordan Crouse <jcrouse@...eaurora.org>
Cc: freedreno <freedreno@...ts.freedesktop.org>,
Douglas Anderson <dianders@...omium.org>,
Kees Cook <keescook@...omium.org>,
Jonathan Marek <jonathan@...ek.ca>,
David Airlie <airlied@...ux.ie>,
MSM <linux-arm-msm@...r.kernel.org>,
Sharat Masetty <smasetty@...eaurora.org>,
lkml <linux-kernel@...r.kernel.org>,
"open list:DRM PANEL DRIVERS" <dri-devel@...ts.freedesktop.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Rob Clark <robdclark@...il.com>,
Mamta Shukla <mamtashukla555@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Sean Paul <sean@...rly.run>
Subject: Re: [Freedreno] [PATCH] drm/msm/adreno: Ensure that the zap shader
region is big enough
On Fri, May 31, 2019 at 4:09 PM Jordan Crouse <jcrouse@...eaurora.org> wrote:
>
> Before loading the zap shader we should ensure that the reserved memory
> region is big enough to hold the loaded file.
>
> Signed-off-by: Jordan Crouse <jcrouse@...eaurora.org>
Reviewed-by: Jeffrey Hugo <jeffrey.l.hugo@...il.com>
> ---
>
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index 6f7f411..3db8e49 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -67,7 +67,6 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
> return ret;
>
> mem_phys = r.start;
> - mem_size = resource_size(&r);
>
> /* Request the MDT file for the firmware */
> fw = adreno_request_fw(to_adreno_gpu(gpu), fwname);
> @@ -83,6 +82,13 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
> goto out;
> }
>
> + if (mem_size > resource_size(&r)) {
> + DRM_DEV_ERROR(dev,
> + "memory region is too small to load the MDT\n");
> + ret = -E2BIG;
> + goto out;
> + }
> +
> /* Allocate memory for the firmware image */
> mem_region = memremap(mem_phys, mem_size, MEMREMAP_WC);
> if (!mem_region) {
> --
> 2.7.4
>
> _______________________________________________
> Freedreno mailing list
> Freedreno@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/freedreno
Powered by blists - more mailing lists