[PATCH] powerpc: make OF interrupt tree parsing more strict
authorSegher Boessenkool <segher@kernel.crashing.org>
Mon, 10 Jul 2006 11:44:45 +0000 (04:44 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 10 Jul 2006 20:24:20 +0000 (13:24 -0700)
This patch fixes a bit of boundchecking in the new Open Firmware interrupt
tree parsing code.  It's important that it fails when things aren't correct in
order to trigger fallback mecanisms that are necessary to make some machines
work properly.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/powerpc/kernel/prom_parse.c

index 21009b1f7869808ef3f6d1befb63416a3d2452bf..6a7e997c401d8ea81cbbf5e3259927c0875000c5 100644 (file)
@@ -881,7 +881,7 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
        intsize = *tmp;
 
        /* Check index */
-       if (index * intsize >= intlen)
+       if ((index + 1) * intsize > intlen)
                return -EINVAL;
 
        /* Get new specifier and map it */