Skip to content

Commit

Permalink
serial: 8250: Check for valid console index
Browse files Browse the repository at this point in the history
Let's not allow negative numbers for console index.

Signed-off-by: Tony Lindgren <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tmlind authored and gregkh committed Oct 5, 2023
1 parent 0d447e9 commit b9cbe7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/tty/serial/8250/8250_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down

0 comments on commit b9cbe7e

Please sign in to comment.