Skip to content

Commit

Permalink
serial: vt8500: Fix range-checking on vt8500_uart_ports
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tony Prisk authored and Greg Kroah-Hartman committed Jan 18, 2013
1 parent f938f37 commit 27dd2e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/tty/serial/vt8500_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 */
Expand Down

0 comments on commit 27dd2e0

Please sign in to comment.