Re: [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21 October 2016 at 12:57, Jaehoon Chung <jh80.chung@xxxxxxxxxxx> wrote:
> platform_get_resource can be returned the NULL pointer.
> Then regs->start should be referred to NULL Pointer.
> devm_ioremap_resource() checks whether res is NULL or not.
>
> Signed-off-by: Jaehoon Chung <jh80.chung@xxxxxxxxxxx>

Thanks, applied for fixes abd I also added a stable tag.

Kind regards
Uffe

> ---
>  drivers/mmc/host/dw_mmc-pltfm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
> index b486fef..1236d49b 100644
> --- a/drivers/mmc/host/dw_mmc-pltfm.c
> +++ b/drivers/mmc/host/dw_mmc-pltfm.c
> @@ -47,12 +47,13 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
>         host->pdata = pdev->dev.platform_data;
>
>         regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       /* Get registers' physical base address */
> -       host->phy_regs = regs->start;
>         host->regs = devm_ioremap_resource(&pdev->dev, regs);
>         if (IS_ERR(host->regs))
>                 return PTR_ERR(host->regs);
>
> +       /* Get registers' physical base address */
> +       host->phy_regs = regs->start;
> +
>         platform_set_drvdata(pdev, host);
>         return dw_mci_probe(host);
>  }
> --
> 2.10.1
>
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]