[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAA8EJpq2dNaRgEqrKpKTTfAm1p=QRZd2z1ouguiA6wUoxA9QAA@mail.gmail.com>
Date: Fri, 22 Apr 2022 13:41:15 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Yang Yingliang <yangyingliang@...wei.com>
Cc: linux-kernel@...r.kernel.org, freedreno@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org,
robdclark@...il.com, jilaiw@...eaurora.org
Subject: Re: [PATCH] drm/msm/hdmi: check return value after calling platform_get_resource_byname()
On Fri, 22 Apr 2022 at 06:10, Yang Yingliang <yangyingliang@...wei.com> wrote:
>
> It will cause null-ptr-deref if platform_get_resource_byname() returns NULL,
> we need check the return value.
>
> Fixes: c6a57a50ad56 ("drm/msm/hdmi: add hdmi hdcp support (V3)")
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> ---
> drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index ec324352e862..07e2ad527af9 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -142,6 +142,10 @@ static struct hdmi *msm_hdmi_init(struct platform_device *pdev)
> /* HDCP needs physical address of hdmi register */
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> config->mmio_name);
> + if (!res) {
> + ret = -EINVAL;
> + goto fail;
> + }
> hdmi->mmio_phy_addr = res->start;
>
> hdmi->qfprom_mmio = msm_ioremap(pdev, config->qfprom_mmio_name);
> --
> 2.25.1
>
--
With best wishes
Dmitry
Powered by blists - more mailing lists