lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFPSGXZLWmahF+ptQC2TT84rB6E0v=V2c6ETkKAd4GKP3c756A@mail.gmail.com>
Date:   Sun, 19 Dec 2021 00:23:07 +0800
From:   Kevin Tang <kevin3.tang@...il.com>
To:     Zou Wei <zou_wei@...wei.com>
Cc:     airlied@...ux.ie, daniel@...ll.ch, orsonzhai@...il.com,
        baolin.wang7@...il.com, zhang.lyra@...il.com,
        maarten.lankhorst@...ux.intel.com, maxime@...no.tech,
        dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] drm/sprd: fix potential NULL dereference

Dear Wei,
Thank you for your notice. I have received it. I will be fix it later.

Best wishes

Zou Wei <zou_wei@...wei.com> 于2021年12月14日周二 17:11写道:
>
> platform_get_resource() may fail and return NULL, so we should
> better check it's return value to avoid a NULL pointer dereference
> a bit later in the code.
>
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Zou Wei <zou_wei@...wei.com>
> ---
>  drivers/gpu/drm/sprd/sprd_dpu.c | 2 ++
>  drivers/gpu/drm/sprd/sprd_dsi.c | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
> index 06a3414..920cb7d 100644
> --- a/drivers/gpu/drm/sprd/sprd_dpu.c
> +++ b/drivers/gpu/drm/sprd/sprd_dpu.c
> @@ -790,6 +790,8 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu,
>         int ret;
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res)
> +               return -EINVAL;
>         ctx->base = devm_ioremap(dev, res->start, resource_size(res));
>         if (!ctx->base) {
>                 dev_err(dev, "failed to map dpu registers\n");
> diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
> index 911b3cd..c90a950 100644
> --- a/drivers/gpu/drm/sprd/sprd_dsi.c
> +++ b/drivers/gpu/drm/sprd/sprd_dsi.c
> @@ -907,6 +907,8 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi,
>         struct resource *res;
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +       if (!res)
> +               return -EINVAL;
>         ctx->base = devm_ioremap(dev, res->start, resource_size(res));
>         if (!ctx->base) {
>                 drm_err(dsi->drm, "failed to map dsi host registers\n");
> --
> 2.6.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ