serial: ar933x_uart: Fix off-by-one for checking valid alias id
authorAxel Lin <axel.lin@ingics.com>
Mon, 23 Feb 2015 03:34:30 +0000 (11:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 7 Mar 2015 02:20:25 +0000 (03:20 +0100)
Current code uses the alias id as array subscript of ar933x_console_ports.
So the valid id is 0 ... CONFIG_SERIAL_AR933X_NR_UARTS - 1.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/ar933x_uart.c

index 77fc9faa74a41f508414440e2c41fc155058d1ce..1519d2ca7705f23eb785b083ed8364b0d46e1de3 100644 (file)
@@ -649,7 +649,7 @@ static int ar933x_uart_probe(struct platform_device *pdev)
                        id = 0;
        }
 
-       if (id > CONFIG_SERIAL_AR933X_NR_UARTS)
+       if (id >= CONFIG_SERIAL_AR933X_NR_UARTS)
                return -EINVAL;
 
        irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);