mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][2.6-mm] early_param console_setup clobbers commandline
@ 2004-04-03  1:32 Zwane Mwaikambo
  2004-04-03  3:05 ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Zwane Mwaikambo @ 2004-04-03  1:32 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Andrew Morton, trini

console_setup clobbers the argument it's passed, resulting in
the commandline being chopped (it inserts a '\0'). A sample command line
would be;

ro root=/dev/hda1 profile=2 debug console=tty0 console=ttyS0,38400 hugepages=20 nmi_watchdog=2

would end up like;

ro root=/dev/hda1 profile=2 debug console=tty0 console=ttyS0

I believe this may be the only setup call which clobbers the argument, so
how about we pass a copy (i wasn't sure about what would be a decent
argument length so i just went with COMMAND_LINE_SIZE (ugly, yes)?
Something like the following tested patch;

Index: linux-2.6.5-rc3-mm4/init/main.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.5-rc3-mm4/init/main.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 main.c
--- linux-2.6.5-rc3-mm4/init/main.c	2 Apr 2004 03:55:28 -0000	1.1.1.1
+++ linux-2.6.5-rc3-mm4/init/main.c	3 Apr 2004 01:21:34 -0000
@@ -410,6 +410,7 @@ void __init parse_early_options(char **c
 	char *from = *cmdline_p;	/* Original. */
 	char c = ' ', *to = tmp_command_line;	/* Parsed. */
 	int len = 0;
+	char arg[COMMAND_LINE_SIZE];

 	/* Save it, if we need to. */
 	if (*cmdline_p != saved_command_line)
@@ -431,7 +432,10 @@ void __init parse_early_options(char **c
 					/* Find the end of this arg, and
 					 * no spaces allowed in an arg. */
 					after = strchr(from, ' ');
-					if (p->fn(from) < 0) {
+					if (after)
+						*after = '\0';
+					strncpy(arg, from, sizeof(arg)-1);
+					if (p->fn(arg) < 0) {
 						from = before;
 						break;
 					}

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-04-04  2:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-03  1:32 [PATCH][2.6-mm] early_param console_setup clobbers commandline Zwane Mwaikambo
2004-04-03  3:05 ` Tom Rini
2004-04-03 15:40   ` Zwane Mwaikambo
2004-04-03 20:14     ` Tom Rini
2004-04-03 20:22       ` Andrew Morton
2004-04-04  0:59         ` Zwane Mwaikambo
2004-04-04  1:08           ` Andrew Morton
2004-04-04  2:04             ` Zwane Mwaikambo

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®