lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 30 Apr 2014 19:48:29 -0500
From:	Rob Herring <robherring2@...il.com>
To:	Yinghai Lu <yinghai@...nel.org>, linux-kernel@...r.kernel.org
Cc:	Rob Herring <robh@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Jiri Slaby <jslaby@...e.cz>, linux-serial@...r.kernel.org
Subject: [PATCH 2/2] tty/serial: fix generic earlycon option parsing

From: Rob Herring <robh@...nel.org>

Commit 9aac5887595 (tty/serial: add generic serial earlycon) moved
console option parsing from 8250_early.c and converted to kstrto*
functions from simple_strtoul along the way. However, kstrto* functions
are not equivalent in that they do not allow non-convertible characters
at the end such as "115200n8". Fix this by changing back to
simple_strtoul and ignore what checkpatch.pl says.

Reported-by: Yinghai Lu <yinghai@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jiri Slaby <jslaby@...e.cz>
Cc: linux-serial@...r.kernel.org
---
 drivers/tty/serial/earlycon.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 73bf1e2..c92e830 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -53,7 +53,7 @@ static int __init parse_options(struct earlycon_device *device,
 				char *options)
 {
 	struct uart_port *port = &device->port;
-	int mmio, mmio32, length, ret;
+	int mmio, mmio32, length;
 	unsigned long addr;
 
 	if (!options)
@@ -64,25 +64,19 @@ static int __init parse_options(struct earlycon_device *device,
 	if (mmio || mmio32) {
 		port->iotype = (mmio ? UPIO_MEM : UPIO_MEM32);
 		options += mmio ? 5 : 7;
-		ret = kstrtoul(options, 0, &addr);
-		if (ret)
-			return ret;
+		addr = simple_strtoul(options, NULL, 0);
 		port->mapbase = addr;
 		if (mmio32)
 			port->regshift = 2;
 	} else if (!strncmp(options, "io,", 3)) {
 		port->iotype = UPIO_PORT;
 		options += 3;
-		ret = kstrtoul(options, 0, &addr);
-		if (ret)
-			return ret;
+		addr = simple_strtoul(options, NULL, 0);
 		port->iobase = addr;
 		mmio = 0;
 	} else if (!strncmp(options, "0x", 2)) {
 		port->iotype = UPIO_MEM;
-		ret = kstrtoul(options, 0, &addr);
-		if (ret)
-			return ret;
+		addr = simple_strtoul(options, NULL, 0);
 		port->mapbase = addr;
 	} else {
 		return -EINVAL;
@@ -93,9 +87,7 @@ static int __init parse_options(struct earlycon_device *device,
 	options = strchr(options, ',');
 	if (options) {
 		options++;
-		ret = kstrtouint(options, 0, &device->baud);
-		if (ret)
-			return ret;
+		device->baud = simple_strtoul(options, NULL, 0);
 		length = min(strcspn(options, " ") + 1,
 			     (size_t)(sizeof(device->options)));
 		strlcpy(device->options, options, length);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ