All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Prisk <linux@prisktech.co.nz>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-mmc@vger.kernel.org, cjb@laptop.org
Subject: Re: [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference
Date: Fri, 13 Sep 2013 06:43:05 +1200	[thread overview]
Message-ID: <52320B39.3080306@prisktech.co.nz> (raw)
In-Reply-To: <1378974078-15416-1-git-send-email-sachin.kamat@linaro.org>

On 12/09/13 20:21, Sachin Kamat wrote:
> 'of_id' is dereferenced before NULL pointer check. Move it to
> after the check.
>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Compile tested.
> ---
>   drivers/mmc/host/wmt-sdmmc.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index 34231d5..3523a72 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -771,7 +771,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
>   	struct device_node *np = pdev->dev.of_node;
>   	const struct of_device_id *of_id =
>   		of_match_device(wmt_mci_dt_ids, &pdev->dev);
> -	const struct wmt_mci_caps *wmt_caps = of_id->data;
> +	const struct wmt_mci_caps *wmt_caps;
>   	int ret;
>   	int regular_irq, dma_irq;
>   
> @@ -780,6 +780,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
>   		return -EFAULT;
>   	}
>   
> +	wmt_caps = of_id->data;
> +
>   	if (!np) {
>   		dev_err(&pdev->dev, "Missing SDMMC description in devicetree\n");
>   		return -EFAULT;

While I don't mind either way, this can never fail anyway. arch-vt8500 
is devicetree only, so the only way the driver will get probed is 
through a compatible-match, and .data must be (and is) specified.

I guess it's still good housekeeping to test it to protect future 
changes so:

Acked-by: Tony Prisk <linux@prisktech.co.nz>

Regards
Tony P

  reply	other threads:[~2013-09-12 18:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12  8:21 [PATCH 1/1] mmc: wmt-sdmmc: Fix NULL pointer dereference Sachin Kamat
2013-09-12 18:43 ` Tony Prisk [this message]
2013-09-27  9:40   ` Sachin Kamat
2013-10-21  3:09 ` Sachin Kamat

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=52320B39.3080306@prisktech.co.nz \
    --to=linux@prisktech.co.nz \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=sachin.kamat@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 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.