From: Peter Hurley <peter@hurleysoftware.com>
To: Michal Simek <michal.simek@xilinx.com>
Cc: linux-kernel@vger.kernel.org, monstr@monstr.eu,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Jiri Slaby <jslaby@suse.cz>, Alan Cox <alan@linux.intel.com>,
Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>,
Tony Lindgren <tony@atomide.com>,
linux-serial@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH v2 2/2] tty: serial: 8250_core: Check that port->line is >=0
Date: Tue, 03 Feb 2015 10:22:44 -0500 [thread overview]
Message-ID: <54D0E7C4.8070308@hurleysoftware.com> (raw)
In-Reply-To: <7904178c3dfbf08191514c8436e66d711455a17c.1422957699.git.michal.simek@xilinx.com>
Hi Michal,
On 02/03/2015 05:01 AM, Michal Simek wrote:
> Add one more checking condition which was originally added by:
> "tty: serial: 8250_core: use the ->line argument as a hint in
> serial8250_find_match_or_unused()"
> (sha1: 59b3e898ddfc81a65975043b5eb44103cc29ff6e)
>
> port->line can be setup by DT driver to -1 which needs to
> be also checked.
What driver is initializing port->line to -1?
Drivers using of_alias_get_id() and/or the platform device id
need to clamp port->line to a valid index before port
registration (or in the case of 8250-type drivers before
8250 port registration.
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> Changes in v2:
> - Change commit message description
> - Do not sign patches - Greg reported problem with it
>
> I have similar patch to 59b3e898ddfc81a65975043b5eb44103cc29ff6e
> in xilinx tree for a while and port->line can be -1.
>
> The second part of this also should be (what other drivers do)
What 'second part of this'?
I only see one change here (and I'd rather see the 8250 core
return NULL if port->line < 0).
Regards,
Peter Hurley
> reading aliases via of_alias_get_id() in of_serial.c:of_platform_serial_probe()
> which setup port.line.
> ---
> drivers/tty/serial/8250/8250_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 65e52c9109e2..aab765177763 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -3512,7 +3512,8 @@ static struct uart_8250_port *serial8250_find_match_or_unused(struct uart_port *
>
> /* try line number first if still available */
> i = port->line;
> - if (i < nr_uarts && serial8250_ports[i].port.type == PORT_UNKNOWN &&
> + if (i >= 0 && i < nr_uarts &&
> + serial8250_ports[i].port.type == PORT_UNKNOWN &&
> serial8250_ports[i].port.iobase == 0)
> return &serial8250_ports[i];
> /*
>
prev parent reply other threads:[~2015-02-03 15:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 10:01 [PATCH v2 1/2] tty: serial: 8250_core: Remove trailing whitespaces Michal Simek
2015-02-03 10:01 ` [PATCH v2 2/2] tty: serial: 8250_core: Check that port->line is >=0 Michal Simek
2015-02-03 15:22 ` Peter Hurley [this message]
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=54D0E7C4.8070308@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=alan@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=mingo@elte.hu \
--cc=monstr@monstr.eu \
--cc=ricardo.ribalda@gmail.com \
--cc=tony@atomide.com \
--cc=yoshihiro.yunomae.ez@hitachi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®