From: Axel Lin Date: Mon, 23 Feb 2015 03:34:30 +0000 (+0800) Subject: serial: ar933x_uart: Fix off-by-one for checking valid alias id X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=bb8478d7d676802211a9a5d77bd0f87899900e41;p=openwrt%2Fstaging%2Fblogic.git serial: ar933x_uart: Fix off-by-one for checking valid alias id 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c index 77fc9faa74a4..1519d2ca7705 100644 --- a/drivers/tty/serial/ar933x_uart.c +++ b/drivers/tty/serial/ar933x_uart.c @@ -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);