[PATCH] Overflow check for i386 assign_irq_vector, 2.6.0-test5

From: James Cleverdon
Date: Thu Sep 11 2003 - 23:10:15 EST


Some very large systems overflow the array and corrupt memory. A BUG_ON will
at least flag the problem until dynamic irq_vector allocation is added.


--
James Cleverdon
IBM xSeries Linux Solutions
{jamesclv(Unix, preferred), cleverdj(Notes)} at us dot ibm dot commdiff -pru 2.6.0-test5/arch/i386/kernel/io_apic.c t5/arch/i386/kernel/io_apic.c
--- 2.6.0-test5/arch/i386/kernel/io_apic.c 2003-09-08 12:50:01.000000000 -0700
+++ t5/arch/i386/kernel/io_apic.c 2003-09-11 12:08:14.000000000 -0700
@@ -1143,6 +1143,7 @@ int irq_vector[NR_IRQS] = { FIRST_DEVICE
static int __init assign_irq_vector(int irq)
{
static int current_vector = FIRST_DEVICE_VECTOR, offset = 0;
+ BUG_ON(irq >= NR_IRQS);
if (IO_APIC_VECTOR(irq) > 0)
return IO_APIC_VECTOR(irq);
next: