All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Dhruva Gole <d-gole@ti.com>,
	John Ogness <john.ogness@linutronix.de>,
	Johan Hovold <johan@kernel.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-serial <linux-serial@vger.kernel.org>
Subject: Re: [PATCH] serial: 8250: Check for valid console index
Date: Wed, 4 Oct 2023 12:21:31 +0300	[thread overview]
Message-ID: <20231004092131.GG34982@atomide.com> (raw)
In-Reply-To: <375d54d0-f874-92d5-91c5-c7ff2b33daff@linux.intel.com>

* Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> [231004 09:13]:
> On Wed, 4 Oct 2023, Tony Lindgren wrote:
> 
> > * Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> [231004 09:05]:
> > > On Wed, 4 Oct 2023, Tony Lindgren wrote:
> > > 
> > > > Let's not allow negative numbers for console index.
> > > > 
> > > > Signed-off-by: Tony Lindgren <tony@atomide.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?
> > 
> > Hmm yeah we should just have them all check for co->index < 0.
> 
> Right but it's only about that, some return -Exx codes (more than one -Exx 
> variant) and some do assign just 0 like here.

What do you have in mind then? They should all assume co->index < 0 is an
invalid console index still, right :)

Regards,

Tony

  reply	other threads:[~2023-10-04  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04  8:55 [PATCH] serial: 8250: Check for valid console index Tony Lindgren
2023-10-04  9:05 ` Ilpo Järvinen
2023-10-04  9:08   ` Tony Lindgren
2023-10-04  9:13     ` Ilpo Järvinen
2023-10-04  9:21       ` Tony Lindgren [this message]
2023-10-05  9:08 ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231004092131.GG34982@atomide.com \
    --to=tony@atomide.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=d-gole@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=johan@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.