* [PATCH] avoid NULL pointer in gpio1_interrupt
@ 2006-09-26 20:28 Olaf Hering
2006-09-26 22:06 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 2+ messages in thread
From: Olaf Hering @ 2006-09-26 20:28 UTC (permalink / raw)
To: Benjamin Herrenschmidt, linuxppc-dev
gpio1_interrupt() may dereference a NULL pointer if ioremap() fails.
But, maybe no gpio interrupt happens in the first place?
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
drivers/macintosh/via-pmu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Index: linux-2.6.18/drivers/macintosh/via-pmu.c
===================================================================
--- linux-2.6.18.orig/drivers/macintosh/via-pmu.c
+++ linux-2.6.18/drivers/macintosh/via-pmu.c
@@ -336,8 +336,10 @@ int __init find_via_pmu(void)
if (gaddr != OF_BAD_ADDR)
gpio_reg = ioremap(gaddr, 0x10);
}
- if (gpio_reg == NULL)
+ if (gpio_reg == NULL) {
printk(KERN_ERR "via-pmu: Can't find GPIO reg !\n");
+ goto fail_gpio;
+ }
} else
pmu_kind = PMU_UNKNOWN;
@@ -366,6 +368,9 @@ int __init find_via_pmu(void)
return 1;
fail:
of_node_put(vias);
+ iounmap(gpio_reg);
+ gpio_reg = NULL;
+ fail_gpio:
vias = NULL;
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] avoid NULL pointer in gpio1_interrupt
2006-09-26 20:28 [PATCH] avoid NULL pointer in gpio1_interrupt Olaf Hering
@ 2006-09-26 22:06 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2006-09-26 22:06 UTC (permalink / raw)
To: Olaf Hering; +Cc: linuxppc-dev
On Tue, 2006-09-26 at 22:28 +0200, Olaf Hering wrote:
> gpio1_interrupt() may dereference a NULL pointer if ioremap() fails.
> But, maybe no gpio interrupt happens in the first place?
Nah, they would happen. Good catch tho I fail to see how ioremap would
fail that early during boot :)
Ben.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-09-26 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-26 20:28 [PATCH] avoid NULL pointer in gpio1_interrupt Olaf Hering
2006-09-26 22:06 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).