aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/serial/arc_uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial/arc_uart.c')
-rw-r--r--drivers/tty/serial/arc_uart.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 77fe306690c4..71e37abb6bcb 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -596,6 +596,11 @@ static int arc_serial_probe(struct platform_device *pdev)
if (dev_id < 0)
dev_id = 0;
+ if (dev_id >= ARRAY_SIZE(arc_uart_ports)) {
+ dev_err(&pdev->dev, "serial%d out of range\n", dev_id);
+ return -EINVAL;
+ }
+
uart = &arc_uart_ports[dev_id];
port = &uart->port;