[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc9a381ef45100c76f26e9cbbc4a9febede54dd5.camel@mediatek.com>
Date: Tue, 24 Dec 2024 08:34:33 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>, "simona@...ll.ch"
<simona@...ll.ch>, Alexandre Mergnat <amergnat@...libre.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
"airlied@...il.com" <airlied@...il.com>, "sui.jingfeng@...ux.dev"
<sui.jingfeng@...ux.dev>, "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>, "karansanghvi98@...il.com"
<karansanghvi98@...il.com>
CC: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "skhan@...uxfoundation.org"
<skhan@...uxfoundation.org>
Subject: Re: [PATCH] drm/mediatek: Initialize pointer before use to avoid
undefiend behaviour
Hi, Karan:
On Mon, 2024-11-11 at 18:14 +0000, Karan Sanghavi wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> Initialize the pointer with NULL as mtk_drm_of_get_ddp_ep_cid
> function might return before assigning value to next pointer
> but yet further dereference to next can lead to some undefined
> behavior as it may point to some invalid location.
Reviewed-by: CK Hu <ck.hu@...iatek.com>
>
> Fixes: 4c932840db1d ("drm/mediatek: Implement OF graphs support for display paths")
> Signed-off-by: Karan Sanghavi <karansanghvi98@...il.com>
> ---
> Coverity Message:
> CID 1601557: (#1 of 1): Uninitialized pointer read (UNINIT)
> 3. uninit_use: Using uninitialized value next.
>
> Coverity Link:
> https://urldefense.com/v3/__https://scan7.scan.coverity.com/*/project-view/10043/11354?selectedIssue=1601557__;Iw!!CTRNKA9wMg0ARbw!hoVl7EQYL36rg2pnVInf2AL6m6mTbIeAsFyOuAlfdlSRMyvrR_vU4CAuIv1h5NnvGEUwMsEY8qxDQ8Mgkc5JyTo$
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 9a8ef8558da9..bc06c664e80f 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -900,7 +900,7 @@ static int mtk_drm_of_ddp_path_build_one(struct device *dev, enum mtk_crtc_path
> const unsigned int **out_path,
> unsigned int *out_path_len)
> {
> - struct device_node *next, *prev, *vdo = dev->parent->of_node;
> + struct device_node *next = NULL, *prev, *vdo = dev->parent->of_node;
> unsigned int temp_path[DDP_COMPONENT_DRM_ID_MAX] = { 0 };
> unsigned int *final_ddp_path;
> unsigned short int idx = 0;
>
> ---
> base-commit: 6d59cab07b8d74d0f0422b750038123334f6ecc2
> change-id: 20241111-uninitializedpointer1601557-9803b725b6bd
>
> Best regards,
> --
> Karan Sanghavi <karansanghvi98@...il.com>
>
Powered by blists - more mailing lists