mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Sachin Kamat <sachin.kamat@linaro.org>
Cc: linux-kernel@vger.kernel.org, sameo@linux.intel.com, spk.linux@gmail.com
Subject: Re: [PATCH Resend] mfd: asic3: Fix potential null pointer dereference
Date: Mon, 16 Jun 2014 18:23:48 +0100	[thread overview]
Message-ID: <20140616172348.GF14323@lee--X1> (raw)
In-Reply-To: <1402394434-903-1-git-send-email-sachin.kamat@linaro.org>

On Tue, 10 Jun 2014, Sachin Kamat wrote:

> We previously assumed 'mem_sdio' could be null but it is
> dereferenced in ioremap(). Add a check to avoid a potential
> null pointer dereference error.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/mfd/asic3.c |   12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
> index 9f6294f2a070..9fc4186d4132 100644
> --- a/drivers/mfd/asic3.c
> +++ b/drivers/mfd/asic3.c
> @@ -899,13 +899,15 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
>  	ds1wm_resources[0].end   >>= asic->bus_shift;
>  
>  	/* MMC */
> -	asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) +
> +	if (mem_sdio) {
> +		asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) +
>  				 mem_sdio->start,
>  				 ASIC3_SD_CONFIG_SIZE >> asic->bus_shift);
> -	if (!asic->tmio_cnf) {
> -		ret = -ENOMEM;
> -		dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n");
> -		goto out;
> +		if (!asic->tmio_cnf) {
> +			ret = -ENOMEM;
> +			dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n");
> +			goto out;
> +		}
>  	}
>  	asic3_mmc_resources[0].start >>= asic->bus_shift;
>  	asic3_mmc_resources[0].end   >>= asic->bus_shift;

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

      reply	other threads:[~2014-06-16 17:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 10:00 Sachin Kamat
2014-06-16 17:23 ` Lee Jones [this message]

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=20140616172348.GF14323@lee--X1 \
    --to=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sachin.kamat@linaro.org \
    --cc=sameo@linux.intel.com \
    --cc=spk.linux@gmail.com \
    /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

all inboxes | Powered by JetHome®