summaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/ebus.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2007-09-27 22:09:28 +0200
committerDavid S. Miller <davem@sunset.davemloft.net>2007-09-27 22:09:28 +0200
commit9c908f97d0f9aee32fa6d4b0a44c4c5d0ccab2b0 (patch)
tree4c863da394fd58a51cdbc4c0386560fe994ee262 /arch/sparc/kernel/ebus.c
parentRevert "[PATCH] x86-64: fix x86_64-mm-sched-clock-share" (diff)
downloadlinux-9c908f97d0f9aee32fa6d4b0a44c4c5d0ccab2b0.tar.xz
linux-9c908f97d0f9aee32fa6d4b0a44c4c5d0ccab2b0.zip
[SPARC]: Fix EBUS use of uninitialized variable.
If of_get_property() fails, it returns NULL and the 'len' parameter is undefined. So we need to explicitly set len to zero in such cases. Noticed by Al Viro. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/ebus.c')
-rw-r--r--arch/sparc/kernel/ebus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index e2d02fd13f35..d850785b2080 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -156,6 +156,8 @@ void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_device *d
dev->prom_node = dp;
regs = of_get_property(dp, "reg", &len);
+ if (!regs)
+ len = 0;
if (len % sizeof(struct linux_prom_registers)) {
prom_printf("UGH: proplen for %s was %d, need multiple of %d\n",
dev->prom_node->name, len,