From: Guenter Roeck <linux@roeck-us.net>
To: Alexander Sverdlin <alexander.sverdlin@nokia.com>,
linux-kernel@vger.kernel.org
Cc: linux-serial@vger.kernel.org, Jiri Slaby <jslaby@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] serial: core: Fix handling of options after MMIO address
Date: Mon, 12 Sep 2016 06:27:21 -0700 [thread overview]
Message-ID: <82c71830-c19b-8eec-3281-13ee0f6514e4@roeck-us.net> (raw)
In-Reply-To: <5e28d338-7667-f889-fae2-5aba0fdeb647@nokia.com>
On 09/12/2016 04:29 AM, Alexander Sverdlin wrote:
> Guenter Roeck reported a regression caused by commit "serial: earlycon:
> Extend earlycon command line option to support 64-bit addresses":
>
> console= and earlycon= options have the following format:
> ...,<addr>,<options>
>
> Historically used here simple_strtoul() had no problems with comma, but the
> new and recommended kstrtoull() requires null-terminated string and returns
> -EINVAL in case there are "options" at the end. There is no recommended to
> use function currently that will support it, so stick to obsolete
> simple_strtoull() variant.
>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> Reported-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/tty/serial/serial_core.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 89f5d6a..f2c8a8d 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1938,14 +1938,11 @@ uart_get_console(struct uart_port *ports, int nr, struct console *co)
> * console=<name>,0x<addr>,<options>
> * is also accepted; the returned @iotype will be UPIO_MEM.
> *
> - * Returns 0 on success, -EINVAL or -ERANGE on failure
> + * Returns 0 on success or -EINVAL on failure
> */
> int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
> char **options)
> {
> - int ret;
> - unsigned long long tmp;
> -
> if (strncmp(p, "mmio,", 5) == 0) {
> *iotype = UPIO_MEM;
> p += 5;
> @@ -1971,10 +1968,11 @@ int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
> return -EINVAL;
> }
>
> - ret = kstrtoull(p, 0, &tmp);
> - if (ret)
> - return ret;
> - *addr = tmp;
> + /*
> + * Before you replace it with kstrtoull(), think about options separator
> + * (',') it will not tolerate
> + */
> + *addr = simple_strtoull(p, NULL, 0);
> p = strchr(p, ',');
> if (p)
> p++;
>
prev parent reply other threads:[~2016-09-12 13:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-02 11:20 [PATCH] serial: earlycon: Extend earlycon command line option to support 64-bit addresses Alexander Sverdlin
2016-09-11 0:45 ` Guenter Roeck
2016-09-12 11:29 ` [PATCH] serial: core: Fix handling of options after MMIO address Alexander Sverdlin
2016-09-12 13:27 ` Guenter Roeck [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=82c71830-c19b-8eec-3281-13ee0f6514e4@roeck-us.net \
--to=linux@roeck-us.net \
--cc=alexander.sverdlin@nokia.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/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®