[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1fc2dc1d-33f2-6d65-6bdb-d4c7421cbc57@linux.intel.com>
Date: Wed, 4 Oct 2023 12:05:35 +0300 (EEST)
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Tony Lindgren <tony@...mide.com>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...el.com>,
Dhruva Gole <d-gole@...com>,
John Ogness <john.ogness@...utronix.de>,
Johan Hovold <johan@...nel.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Vignesh Raghavendra <vigneshr@...com>,
LKML <linux-kernel@...r.kernel.org>,
linux-serial <linux-serial@...r.kernel.org>
Subject: Re: [PATCH] serial: 8250: Check for valid console index
On Wed, 4 Oct 2023, Tony Lindgren wrote:
> Let's not allow negative numbers for console index.
>
> Signed-off-by: Tony Lindgren <tony@...mide.com>
> ---
> drivers/tty/serial/8250/8250_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> --- 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;
The inconsistencies how different serial drivers handle this situation
seem staggering. Perhaps there should be some effort to make the behavior
uniform across them?
--
i.
Powered by blists - more mailing lists