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>] [day] [month] [year] [list]
Message-ID: <20060913101122.72d7c0a1@cad-250-152.norway.atmel.com>
Date:	Wed, 13 Sep 2006 10:11:22 +0200
From:	Haavard Skinnemoen <hskinnemoen@...el.com>
To:	Andrew Morton <akpm@...l.org>
Cc:	linux-kernel@...r.kernel.org,
	Rusty Russell <rusty@...tcorp.com.au>,
	Alon Bar-Lev <alon.barlev@...il.com>
Subject: [-mm patch] AVR32: Use parse_early_param

Get rid of the AVR32-specific parse_cmdline_early function and call
parse_early_param instead. Parsing of the "fbmem=" parameter has been
implemented using early_param, allowing it to be greatly simplified.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@...el.com>
---
 arch/avr32/kernel/setup.c |   60 ++++++++++++++--------------------------------
 1 file changed, 19 insertions(+), 41 deletions(-)

Index: linux-2.6.18-rc5-mm1/arch/avr32/kernel/setup.c
===================================================================
--- linux-2.6.18-rc5-mm1.orig/arch/avr32/kernel/setup.c	2006-09-07 09:40:48.000000000 +0200
+++ linux-2.6.18-rc5-mm1/arch/avr32/kernel/setup.c	2006-09-07 10:05:07.000000000 +0200
@@ -90,48 +90,24 @@ static struct resource mem_res[] = {
 static unsigned long __initdata fbmem_start;
 static unsigned long __initdata fbmem_size;
 
-/* --- */
-
-static void __init parse_cmdline_early(char **cmdline_p)
+/*
+ * "fbmem=xxx[kKmM]" allocates the specified amount of boot memory for
+ * use as framebuffer.
+ *
+ * "fbmem=xxx[kKmM]@yyy[kKmM]" defines a memory region of size xxx and
+ * starting at yyy to be reserved for use as framebuffer.
+ *
+ * The kernel won't verify that the memory region starting at yyy
+ * actually contains usable RAM.
+ */
+static int __init early_parse_fbmem(char *p)
 {
-	char *to = command_line, *from = saved_command_line;
-	int len = 0;
-	char c = ' ';
-
-	for (;;) {
-		if (c != ' ')
-			goto next_char;
-
-		/*
-		 * "fbmem=xxx[kKmM]" allocates the specified amount of
-		 * boot memory for use as framebuffer.
-		 * "fbmem=xxx[kKmM]@yyy" defines a memory region of
-		 * size xxx and starting at yyy to be reserved for use
-		 * as framebuffer.
-		 *
-		 * The kernel won't verify that the memory region
-		 * starting at yyy actually contains usable RAM.
-		 */
-		if (!memcmp(from, "fbmem=", 6)) {
-			if (to != command_line)
-				to--;
-			fbmem_size = memparse(from + 6, &from);
-			if (*from == '@')
-				fbmem_start = memparse(from + 1, &from);
-		}
-
-	next_char:
-		c = *(from++);
-		if (c == '\0')
-			break;
-		if (COMMAND_LINE_SIZE <= ++len)
-			break;
-		*(to++) = c;
-	}
-
-	*to = '\0';
-	*cmdline_p = command_line;
+	fbmem_size = memparse(p, &p);
+	if (*p == '@')
+		fbmem_start = memparse(p, &p);
+	return 0;
 }
+early_param("fbmem", early_parse_fbmem);
 
 static inline void __init resource_init(void)
 {
@@ -341,7 +317,9 @@ void __init setup_arch (char **cmdline_p
 	init_mm.end_data = (unsigned long) &_edata;
 	init_mm.brk = (unsigned long) &_end;
 
-	parse_cmdline_early(cmdline_p);
+	strlcpy(command_line, saved_command_line, COMMAND_LINE_SIZE);
+	*cmdline_p = command_line;
+	parse_early_param();
 
 	setup_bootmem();
 
-
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