MIPS: OCTEON: Off by one in octeon_irq_gpio_map()
Subsystems (2)
PATCH 1/1 MIPS: OCTEON: Off by one in octeon_irq_gpio_map()
It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().
Fixes 64b139f97c01 ('MIPS: OCTEON: irq: add CIB and other fixes')
Signed-off-by Dan Carpenter <[email protected]>
arch/mips/cavium-octeon/octeon-irq.c +1 -1
@@ -1260,7 +1260,7 @@ static int octeon_irq_gpio_map(struct irq_domain *d, line = (hw + gpiod->base_hwirq) >>6 ; bit = (hw + gpiod->base_hwirq) &63 ; -if (line >ARRAY_SIZE (octeon_irq_ciu_to_irq) || +if (line >=ARRAY_SIZE (octeon_irq_ciu_to_irq) || octeon_irq_ciu_to_irq[line][bit] !=0 )return -EINVAL ;
Quoted 4 lines · Dan Carpenter
It should be >=
ARRAY_SIZE()instead of >ARRAY_SIZE().Fixes 64b139f97c01 ('MIPS: OCTEON: irq: add CIB and other fixes')Signed-off-by Dan Carpenter <[email protected]>
Good catch. This would probably only matter if a malformed device tree, or buggy device driver were encountered.
Acked-by David Daney <[email protected]>
Quoted 15 lines
arch/mips/cavium-octeon/octeon-irq.c +1
-1@@ -1260,7 +1260,7 @@ static int octeon_irq_gpio_map(struct irq_domain *d, line = (hw + gpiod->base_hwirq) >>6 ; bit = (hw + gpiod->base_hwirq) &63 ; -if (line >ARRAY_SIZE (octeon_irq_ciu_to_irq) || +if (line >=ARRAY_SIZE (octeon_irq_ciu_to_irq) || octeon_irq_ciu_to_irq[line][bit] !=0 )return -EINVAL ;