public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Shawn Lin <shawn.lin@rock-chips.com>
To: Jaehoon Chung <jh80.chung@samsung.com>
Cc: linux-mmc@vger.kernel.org, shawn.lin@rock-chips.com,
	ulf.hansson@linaro.org, stable@vger.kernel.org,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH] mmc: dw_mmc-pltfm: fix the potential NULL pointer dereference
Date: Mon, 24 Oct 2016 20:06:06 +0800	[thread overview]
Message-ID: <89043543-b179-e7e4-4098-8fba45fe445c@rock-chips.com> (raw)
In-Reply-To: <20161021105757.22712-1-jh80.chung@samsung.com>

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

  reply	other threads:[~2016-10-24 12:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-10-25  8:48 ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89043543-b179-e7e4-4098-8fba45fe445c@rock-chips.com \
    --to=shawn.lin@rock-chips.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jh80.chung@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox