]> err.no Git - linux-2.6/commitdiff
[PATCH] Serial: Fix small CONFIG_SERIAL_8250_NR_UARTS
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Thu, 30 Jun 2005 21:41:22 +0000 (22:41 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 30 Jun 2005 21:41:22 +0000 (22:41 +0100)
If CONFIG_SERIAL_8250_NR_UARTS is smaller than the array size in
asm/serial.h, we trampled on memory which wasn't ours.  Take our
big boots away by limiting the number of ports initialised to the
smaller of ...NR_UARTS and the array size.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/serial/8250.c

index 9224fc3184ea35d5296f3d369cc85114440a5c0c..7e8fc7c1d4cc79768b3eb53da4f338ba09d80dc4 100644 (file)
@@ -2061,7 +2061,8 @@ static void __init serial8250_isa_init_ports(void)
                up->port.ops = &serial8250_pops;
        }
 
-       for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
+       for (i = 0, up = serial8250_ports;
+            i < ARRAY_SIZE(old_serial_port) && i < UART_NR;
             i++, up++) {
                up->port.iobase   = old_serial_port[i].port;
                up->port.irq      = irq_canonicalize(old_serial_port[i].irq);