mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: Liankun Yang <liankun.yang@mediatek.com>,
	chunkuang.hu@kernel.org, p.zabel@pengutronix.de,
	airlied@gmail.com, simona@ffwll.ch, matthias.bgg@gmail.com,
	rex-bc.chen@mediatek.com, msp@baylibre.com,
	granquet@baylibre.com, dmitry.osipenko@collabora.com,
	jitao.shi@mediatek.com, mac.shen@mediatek.com,
	peng.liu@mediatek.com
Cc: Project_Global_Chrome_Upstream_Group@mediatek.com,
	dri-devel@lists.freedesktop.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 1/1] drm/mediatek: Fix wrong check of nvmem_cell_read
Date: Thu, 26 Sep 2024 11:33:59 +0200	[thread overview]
Message-ID: <d8f54575-6df8-4198-a078-70debc9f8e0b@collabora.com> (raw)
In-Reply-To: <20240925084116.28848-1-liankun.yang@mediatek.com>

Il 25/09/24 10:40, Liankun Yang ha scritto:
> If the len is 0, kernel crash will occur when performing operations.
> Add the len check conditions to prevent kernel crash.
> 

Please fix the commit title:

drm/mediatek: mtk_dp: Fix potential KP on 0 bytes nvmem cell read

> Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
> 

Please remove this blank line between the Fixes tag and your S-o-b.

> Signed-off-by: Liankun Yang <liankun.yang@mediatek.com>
> ---
>   drivers/gpu/drm/mediatek/mtk_dp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
> index d8796a904eca..0cc75ba96b98 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -1082,7 +1082,7 @@ static void mtk_dp_get_calibration_data(struct mtk_dp *mtk_dp)
>   	buf = (u32 *)nvmem_cell_read(cell, &len);
>   	nvmem_cell_put(cell);
>   
> -	if (IS_ERR(buf) || ((len / sizeof(u32)) != 4)) {
> +	if (IS_ERR(buf) || (len == 0) || ((len / sizeof(u32)) != 4)) {

if (IS_ERR(buf) || !len || ((len / sizeof(u32)) != 4)) {

Cheers,
Angelo


      reply	other threads:[~2024-09-26  9:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25  8:40 Liankun Yang
2024-09-26  9:33 ` AngeloGioacchino Del Regno [this message]

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=d8f54575-6df8-4198-a078-70debc9f8e0b@collabora.com \
    --to=angelogioacchino.delregno@collabora.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=granquet@baylibre.com \
    --cc=jitao.shi@mediatek.com \
    --cc=liankun.yang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mac.shen@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=msp@baylibre.com \
    --cc=p.zabel@pengutronix.de \
    --cc=peng.liu@mediatek.com \
    --cc=rex-bc.chen@mediatek.com \
    --cc=simona@ffwll.ch \
    /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®