console: more buf for index parsing

Change name to buf according to the usage as name + index

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Gerd Hoffmann <kraxel@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Yinghai Lu
2007-07-15 23:37:27 -07:00
committed by Linus Torvalds
parent 79492689e4
commit eaa944afb2

View File

@@ -654,7 +654,7 @@ static void call_console_drivers(unsigned long start, unsigned long end)
*/ */
static int __init console_setup(char *str) static int __init console_setup(char *str)
{ {
char name[sizeof(console_cmdline[0].name)]; char buf[sizeof(console_cmdline[0].name) + 4]; /* 4 for index */
char *s, *options; char *s, *options;
int idx; int idx;
@@ -662,27 +662,27 @@ static int __init console_setup(char *str)
* Decode str into name, index, options. * Decode str into name, index, options.
*/ */
if (str[0] >= '0' && str[0] <= '9') { if (str[0] >= '0' && str[0] <= '9') {
strcpy(name, "ttyS"); strcpy(buf, "ttyS");
strncpy(name + 4, str, sizeof(name) - 5); strncpy(buf + 4, str, sizeof(buf) - 5);
} else { } else {
strncpy(name, str, sizeof(name) - 1); strncpy(buf, str, sizeof(buf) - 1);
} }
name[sizeof(name) - 1] = 0; buf[sizeof(buf) - 1] = 0;
if ((options = strchr(str, ',')) != NULL) if ((options = strchr(str, ',')) != NULL)
*(options++) = 0; *(options++) = 0;
#ifdef __sparc__ #ifdef __sparc__
if (!strcmp(str, "ttya")) if (!strcmp(str, "ttya"))
strcpy(name, "ttyS0"); strcpy(buf, "ttyS0");
if (!strcmp(str, "ttyb")) if (!strcmp(str, "ttyb"))
strcpy(name, "ttyS1"); strcpy(buf, "ttyS1");
#endif #endif
for (s = name; *s; s++) for (s = buf; *s; s++)
if ((*s >= '0' && *s <= '9') || *s == ',') if ((*s >= '0' && *s <= '9') || *s == ',')
break; break;
idx = simple_strtoul(s, NULL, 10); idx = simple_strtoul(s, NULL, 10);
*s = 0; *s = 0;
add_preferred_console(name, idx, options); add_preferred_console(buf, idx, options);
return 1; return 1;
} }
__setup("console=", console_setup); __setup("console=", console_setup);