aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2023-10-04 11:55:10 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-10-05 09:41:17 +0200
commitb9cbe7e8f27b4e4ab38db5ba5634d12f86574ca7 (patch)
treeb95f207a66a059c7ed591072379f68c9a1254d6c /drivers/tty/serial
parent0d447e927ee86e9ff89010085a47a275c2bb5594 (diff)
serial: 8250: Check for valid console index
Let's not allow negative numbers for console index. Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20231004085511.42645-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 904e319e6b4a..912733151858 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -611,7 +611,7 @@ static int univ8250_console_setup(struct console *co, char *options)
* if so, search for the first available port that does have
* console support.
*/
- if (co->index >= UART_NR)
+ if (co->index < 0 || co->index >= UART_NR)
co->index = 0;
/*