]> git.karo-electronics.de Git - linux-beck.git/commitdiff
serial: vt8500: Fix range-checking on vt8500_uart_ports
authorTony Prisk <linux@prisktech.co.nz>
Wed, 16 Jan 2013 19:05:40 +0000 (08:05 +1300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jan 2013 01:24:15 +0000 (17:24 -0800)
Fix two instances where the index to vt8500_uart_ports is tested
against > VT8500_MAX_PORTS. Correct usage should be >= VT8500_MAX_PORTS.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/vt8500_serial.c

index f1a398c672fa386989b23a24f9f0611d5e6286fa..e50deb771616407d6a7fd035bb967a18f9609948 100644 (file)
@@ -560,7 +560,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
 
        if (np)
                port = of_alias_get_id(np, "serial");
-               if (port > VT8500_MAX_PORTS)
+               if (port >= VT8500_MAX_PORTS)
                        port = -1;
        else
                port = -1;
@@ -571,7 +571,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
                                        sizeof(vt8500_ports_in_use));
        }
 
-       if (port > VT8500_MAX_PORTS)
+       if (port >= VT8500_MAX_PORTS)
                return -ENODEV;
 
        /* reserve the port id */