From: Philippe CORNU <philippe.cornu@st.com>
To: Yannick FERTRE <yannick.fertre@st.com>,
Benjamin GAIGNARD <benjamin.gaignard@st.com>,
Vincent ABRIOU <vincent.abriou@st.com>,
"David Airlie" <airlied@linux.ie>,
Daniel Vetter <daniel@ffwll.ch>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre TORGUE <alexandre.torgue@st.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-stm32@st-md-mailman.stormreply.com"
<linux-stm32@st-md-mailman.stormreply.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/stm: ltdc: limit number of layer to avoid memory overflow
Date: Fri, 5 Apr 2019 16:30:10 +0000 [thread overview]
Message-ID: <51100130-dfe9-ae21-6efb-b1394f607bdd@st.com> (raw)
In-Reply-To: <1554283216-2700-1-git-send-email-yannick.fertre@st.com>
Dear Yannick,
Thank you for your patch,
Acked-by: Philippe Cornu <philippe.cornu@st.com>
Philippe :)
On 4/3/19 11:20 AM, Yannick Fertré wrote:
> If the number of layer is greater than LTDC_MAX_LAYER, we can have
> memory overflow when reading plane_fpsi[].
>
> Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
> ---
> drivers/gpu/drm/stm/ltdc.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c
> index 32fd6a3..05bd4b6 100644
> --- a/drivers/gpu/drm/stm/ltdc.c
> +++ b/drivers/gpu/drm/stm/ltdc.c
> @@ -1021,10 +1021,13 @@ static int ltdc_get_caps(struct drm_device *ddev)
> struct ltdc_device *ldev = ddev->dev_private;
> u32 bus_width_log2, lcr, gc2r;
>
> - /* at least 1 layer must be managed */
> + /*
> + * at least 1 layer must be managed & the number of layers
> + * must not exceed LTDC_MAX_LAYER
> + */
> lcr = reg_read(ldev->regs, LTDC_LCR);
>
> - ldev->caps.nb_layers = max_t(int, lcr, 1);
> + ldev->caps.nb_layers = clamp((int)lcr, 1, LTDC_MAX_LAYER);
>
> /* set data bus width */
> gc2r = reg_read(ldev->regs, LTDC_GC2R);
>
next prev parent reply other threads:[~2019-04-05 16:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-03 9:20 Yannick Fertré
2019-04-05 16:30 ` Philippe CORNU [this message]
2019-04-24 12:28 ` Benjamin Gaignard
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=51100130-dfe9-ae21-6efb-b1394f607bdd@st.com \
--to=philippe.cornu@st.com \
--cc=airlied@linux.ie \
--cc=alexandre.torgue@st.com \
--cc=benjamin.gaignard@st.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=vincent.abriou@st.com \
--cc=yannick.fertre@st.com \
/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
all inboxes | Powered by JetHome®