[PATCH] Check the irq number is within bounds

Most of the functions already check. Do the ones that didn't.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Matthew Wilcox and committed by Linus Torvalds c2b5a251 2d0ebb36

+15
+15
kernel/irq/manage.c
··· 36 { 37 struct irq_desc *desc = irq_desc + irq; 38 39 while (desc->status & IRQ_INPROGRESS) 40 cpu_relax(); 41 } ··· 62 { 63 irq_desc_t *desc = irq_desc + irq; 64 unsigned long flags; 65 66 spin_lock_irqsave(&desc->lock, flags); 67 if (!desc->depth++) { ··· 92 { 93 irq_desc_t *desc = irq_desc + irq; 94 95 disable_irq_nosync(irq); 96 if (desc->action) 97 synchronize_irq(irq); ··· 116 { 117 irq_desc_t *desc = irq_desc + irq; 118 unsigned long flags; 119 120 spin_lock_irqsave(&desc->lock, flags); 121 switch (desc->depth) { ··· 174 struct irqaction *old, **p; 175 unsigned long flags; 176 int shared = 0; 177 178 if (desc->handler == &no_irq_type) 179 return -ENOSYS;
··· 36 { 37 struct irq_desc *desc = irq_desc + irq; 38 39 + if (irq >= NR_IRQS) 40 + return; 41 + 42 while (desc->status & IRQ_INPROGRESS) 43 cpu_relax(); 44 } ··· 59 { 60 irq_desc_t *desc = irq_desc + irq; 61 unsigned long flags; 62 + 63 + if (irq >= NR_IRQS) 64 + return; 65 66 spin_lock_irqsave(&desc->lock, flags); 67 if (!desc->depth++) { ··· 86 { 87 irq_desc_t *desc = irq_desc + irq; 88 89 + if (irq >= NR_IRQS) 90 + return; 91 + 92 disable_irq_nosync(irq); 93 if (desc->action) 94 synchronize_irq(irq); ··· 107 { 108 irq_desc_t *desc = irq_desc + irq; 109 unsigned long flags; 110 + 111 + if (irq >= NR_IRQS) 112 + return; 113 114 spin_lock_irqsave(&desc->lock, flags); 115 switch (desc->depth) { ··· 162 struct irqaction *old, **p; 163 unsigned long flags; 164 int shared = 0; 165 + 166 + if (irq >= NR_IRQS) 167 + return -EINVAL; 168 169 if (desc->handler == &no_irq_type) 170 return -ENOSYS;