diff options
author | 2009-01-04 03:11:05 +0900 | |
---|---|---|
committer | 2009-01-07 23:18:08 +0100 | |
commit | 01d07820a0df6b6134c1bb75b1e84c9d0cdab3be (patch) | |
tree | 381feeeacd197139e7fab66f2829a8390cbbcab2 /include/linux/irqnr.h | |
parent | Fix up 64-bit byte swaps for most 32-bit architectures (diff) | |
download | linux-01d07820a0df6b6134c1bb75b1e84c9d0cdab3be.tar.gz linux-01d07820a0df6b6134c1bb75b1e84c9d0cdab3be.tar.bz2 linux-01d07820a0df6b6134c1bb75b1e84c9d0cdab3be.zip |
sparseirq: make for_each_irq_desc() more robust
Raja reported for_each_irq_desc() has possibility unsafeness:
if anyone write folliwing code, for_each_irq_desc() doesn't work
as intended:
(right now this code does not exist at all)
if (safe)
for_each_irq_desc(irq, desc) {
...
}
else
panic();
Reported-by: Raja R Harinath <harinath@hurrynot.org>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/irqnr.h')
-rw-r--r-- | include/linux/irqnr.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/irqnr.h b/include/linux/irqnr.h index 86af92e9e84c..52ebbb4b161d 100644 --- a/include/linux/irqnr.h +++ b/include/linux/irqnr.h @@ -28,13 +28,17 @@ extern struct irq_desc *irq_to_desc(unsigned int irq); # define for_each_irq_desc(irq, desc) \ for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \ irq++, desc = irq_to_desc(irq)) \ - if (desc) + if (!desc) \ + ; \ + else # define for_each_irq_desc_reverse(irq, desc) \ for (irq = nr_irqs - 1, desc = irq_to_desc(irq); irq >= 0; \ irq--, desc = irq_to_desc(irq)) \ - if (desc) + if (!desc) \ + ; \ + else #endif /* CONFIG_GENERIC_HARDIRQS */ |