* [patch] MIPS: OCTEON: Off by one in octeon_irq_gpio_map()
@ 2016-07-14 10:14 Dan Carpenter
2016-07-14 15:38 ` David Daney
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-07-14 10:14 UTC (permalink / raw)
To: Ralf Baechle, David Daney
Cc: Rob Herring, Marc Zyngier, linux-mips, kernel-janitors
It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().
Fixes: 64b139f97c01 ('MIPS: OCTEON: irq: add CIB and other fixes')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 368eb49..75a4add 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] MIPS: OCTEON: Off by one in octeon_irq_gpio_map()
2016-07-14 10:14 [patch] MIPS: OCTEON: Off by one in octeon_irq_gpio_map() Dan Carpenter
@ 2016-07-14 15:38 ` David Daney
0 siblings, 0 replies; 2+ messages in thread
From: David Daney @ 2016-07-14 15:38 UTC (permalink / raw)
To: Dan Carpenter
Cc: Ralf Baechle, David Daney, Rob Herring, Marc Zyngier, linux-mips,
kernel-janitors
On 07/14/2016 03:14 AM, Dan Carpenter wrote:
> It should be >= ARRAY_SIZE() instead of > ARRAY_SIZE().
>
> Fixes: 64b139f97c01 ('MIPS: OCTEON: irq: add CIB and other fixes')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Good catch. This would probably only matter if a malformed device tree,
or buggy device driver were encountered.
Acked-by: David Daney <david.daney@cavium.com>
>
> diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
> index 368eb49..75a4add 100644
> --- a/arch/mips/cavium-octeon/octeon-irq.c
> +++ b/arch/mips/cavium-octeon/octeon-irq.c
> @@ -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;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-14 15:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14 10:14 [patch] MIPS: OCTEON: Off by one in octeon_irq_gpio_map() Dan Carpenter
2016-07-14 15:38 ` David Daney
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).