All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference
@ 2016-10-21 10:57 Jaehoon Chung
  2016-10-24 12:06 ` Shawn Lin
  2016-10-25  8:48 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Jaehoon Chung @ 2016-10-21 10:57 UTC (permalink / raw)
  To: linux-mmc; +Cc: ulf.hansson, shawn.lin, stable, gregkh, Jaehoon Chung

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@samsung.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference
  2016-10-21 10:57 [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference Jaehoon Chung
@ 2016-10-24 12:06 ` Shawn Lin
  2016-10-25  8:48 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn Lin @ 2016-10-24 12:06 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, shawn.lin, ulf.hansson, stable, gregkh

On 2016/10/21 18:57, Jaehoon Chung 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@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc-pltfm.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>

Looks good,

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> 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);
>  }
>


-- 
Best Regards
Shawn Lin


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference
  2016-10-21 10:57 [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference Jaehoon Chung
  2016-10-24 12:06 ` Shawn Lin
@ 2016-10-25  8:48 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2016-10-25  8:48 UTC (permalink / raw)
  To: Jaehoon Chung; +Cc: linux-mmc, Shawn Lin, # 4.0+, Greg Kroah-Hartman

On 21 October 2016 at 12:57, Jaehoon Chung <jh80.chung@samsung.com> 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@samsung.com>

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-25  8:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-21 10:57 [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference Jaehoon Chung
2016-10-24 12:06 ` Shawn Lin
2016-10-25  8:48 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.