* [PATCH Resend] mfd: asic3: Fix potential null pointer dereference
@ 2014-06-10 10:00 Sachin Kamat
2014-06-16 17:23 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Sachin Kamat @ 2014-06-10 10:00 UTC (permalink / raw)
To: linux-kernel; +Cc: lee.jones, sameo, spk.linux
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(-)
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;
--
1.7.9.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH Resend] mfd: asic3: Fix potential null pointer dereference
2014-06-10 10:00 [PATCH Resend] mfd: asic3: Fix potential null pointer dereference Sachin Kamat
@ 2014-06-16 17:23 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2014-06-16 17:23 UTC (permalink / raw)
To: Sachin Kamat; +Cc: linux-kernel, sameo, spk.linux
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-16 17:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 10:00 [PATCH Resend] mfd: asic3: Fix potential null pointer dereference Sachin Kamat
2014-06-16 17:23 ` Lee Jones
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®