From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Jordan Crouse <jcrouse@codeaurora.org>
Cc: freedreno@lists.freedesktop.org, Sean Paul <sean@poorly.run>,
Kees Cook <keescook@chromium.org>,
linux-arm-msm@vger.kernel.org,
Sharat Masetty <smasetty@codeaurora.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Douglas Anderson <dianders@chromium.org>,
Rob Clark <robdclark@gmail.com>, David Airlie <airlied@linux.ie>,
Jonathan Marek <jonathan@marek.ca>,
Mamta Shukla <mamtashukla555@gmail.com>,
Daniel Vetter <daniel@ffwll.ch>
Subject: Re: [PATCH] drm/msm/adreno: Ensure that the zap shader region is big enough
Date: Fri, 31 May 2019 22:48:04 -0700 [thread overview]
Message-ID: <20190601054804.GF22737@tuxbook-pro> (raw)
In-Reply-To: <1559340578-11482-1-git-send-email-jcrouse@codeaurora.org>
On Fri 31 May 15:09 PDT 2019, Jordan Crouse 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@codeaurora.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>
> 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
>
next prev parent reply other threads:[~2019-06-01 5:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 22:09 [PATCH] drm/msm/adreno: Ensure that the zap shader region is big enough Jordan Crouse
2019-06-01 5:48 ` Bjorn Andersson [this message]
2019-06-03 14:56 ` [Freedreno] " Jeffrey Hugo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190601054804.GF22737@tuxbook-pro \
--to=bjorn.andersson@linaro.org \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jcrouse@codeaurora.org \
--cc=jonathan@marek.ca \
--cc=keescook@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mamtashukla555@gmail.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=smasetty@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).