[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d8f54575-6df8-4198-a078-70debc9f8e0b@collabora.com>
Date: Thu, 26 Sep 2024 11:33:59 +0200
From: AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>
To: Liankun Yang <liankun.yang@...iatek.com>, chunkuang.hu@...nel.org,
p.zabel@...gutronix.de, airlied@...il.com, simona@...ll.ch,
matthias.bgg@...il.com, rex-bc.chen@...iatek.com, msp@...libre.com,
granquet@...libre.com, dmitry.osipenko@...labora.com,
jitao.shi@...iatek.com, mac.shen@...iatek.com, peng.liu@...iatek.com
Cc: Project_Global_Chrome_Upstream_Group@...iatek.com,
dri-devel@...ts.freedesktop.org, linux-mediatek@...ts.infradead.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v1 1/1] drm/mediatek: Fix wrong check of nvmem_cell_read
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@...iatek.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
Powered by blists - more mailing lists