aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorTony Prisk <linux@prisktech.co.nz>2013-01-16 14:05:40 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 20:24:15 -0500
commit27dd2e04923341cff96aae164117c44da1072c32 (patch)
tree879a03ce36fc13e1f9bcff0e8f281d429e73a75e /drivers/tty/serial
parentf938f3781fa877146236042341ddbcf06bc49f0a (diff)
serial: vt8500: Fix range-checking on vt8500_uart_ports
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>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/vt8500_serial.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index f1a398c672fa..e50deb771616 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -560,7 +560,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
560 560
561 if (np) 561 if (np)
562 port = of_alias_get_id(np, "serial"); 562 port = of_alias_get_id(np, "serial");
563 if (port > VT8500_MAX_PORTS) 563 if (port >= VT8500_MAX_PORTS)
564 port = -1; 564 port = -1;
565 else 565 else
566 port = -1; 566 port = -1;
@@ -571,7 +571,7 @@ static int vt8500_serial_probe(struct platform_device *pdev)
571 sizeof(vt8500_ports_in_use)); 571 sizeof(vt8500_ports_in_use));
572 } 572 }
573 573
574 if (port > VT8500_MAX_PORTS) 574 if (port >= VT8500_MAX_PORTS)
575 return -ENODEV; 575 return -ENODEV;
576 576
577 /* reserve the port id */ 577 /* reserve the port id */