diff options
| author | Andrew Morton <akpm@osdl.org> | 2004-02-23 04:50:28 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-02-23 04:50:28 -0800 |
| commit | 95f6d0ffe43dd8f5c93f75889fd51ca7fb5fd1a1 (patch) | |
| tree | 872eaeb4ebe696010d205ac0b7ab4d9241484d57 | |
| parent | f3f622562830148c862bf5d7da4537f9ee5291ab (diff) | |
[PATCH] ppc64: fix cmd_line bugs
From: Anton Blanchard <anton@samba.org>
There were a number of bugs in our cmd_line handling:
- We were looking at cmd_line after it had been tokenised. Use saved_command
line instead
- Use strlcpy instead of memcpy/explicit NULL set.
- Remove magic numbers in iseries cmd_line parsing
| -rw-r--r-- | arch/ppc64/kernel/chrp_setup.c | 1 | ||||
| -rw-r--r-- | arch/ppc64/kernel/eeh.c | 6 | ||||
| -rw-r--r-- | arch/ppc64/kernel/head.S | 2 | ||||
| -rw-r--r-- | arch/ppc64/kernel/pmac_setup.c | 1 | ||||
| -rw-r--r-- | arch/ppc64/kernel/prom.c | 6 | ||||
| -rw-r--r-- | arch/ppc64/kernel/setup.c | 2 | ||||
| -rw-r--r-- | include/asm-ppc64/machdep.h | 1 |
7 files changed, 7 insertions, 12 deletions
diff --git a/arch/ppc64/kernel/chrp_setup.c b/arch/ppc64/kernel/chrp_setup.c index b112cd9b2ec7..bb0083d1c756 100644 --- a/arch/ppc64/kernel/chrp_setup.c +++ b/arch/ppc64/kernel/chrp_setup.c @@ -129,7 +129,6 @@ void __init chrp_request_regions(void) void __init chrp_setup_arch(void) { - extern char cmd_line[]; struct device_node *root; unsigned int *opprop; diff --git a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c index c338f57a206d..c67294aff69e 100644 --- a/arch/ppc64/kernel/eeh.c +++ b/arch/ppc64/kernel/eeh.c @@ -247,10 +247,8 @@ void eeh_init(void) { struct device_node *phb; struct eeh_early_enable_info info; - - extern char cmd_line[]; /* Very early cmd line parse. Cheap, but works. */ - char *eeh_force_off = strstr(cmd_line, "eeh-force-off"); - char *eeh_force_on = strstr(cmd_line, "eeh-force-on"); + char *eeh_force_off = strstr(saved_command_line, "eeh-force-off"); + char *eeh_force_on = strstr(saved_command_line, "eeh-force-on"); ibm_set_eeh_option = rtas_token("ibm,set-eeh-option"); ibm_set_slot_reset = rtas_token("ibm,set-slot-reset"); diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S index e4d46294d267..f1600468546a 100644 --- a/arch/ppc64/kernel/head.S +++ b/arch/ppc64/kernel/head.S @@ -2177,4 +2177,4 @@ stab_array: */ .globl cmd_line cmd_line: - .space 512 + .space 512 /* COMMAND_LINE_SIZE */ diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c index 4c33810dc82c..cffbf60c291d 100644 --- a/arch/ppc64/kernel/pmac_setup.c +++ b/arch/ppc64/kernel/pmac_setup.c @@ -73,7 +73,6 @@ #include "pmac.h" -extern char saved_command_line[]; static int current_root_goodness = -1; #define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */ diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c index 5a6182b940d4..a0e13ed6abde 100644 --- a/arch/ppc64/kernel/prom.c +++ b/arch/ppc64/kernel/prom.c @@ -52,6 +52,7 @@ #include <asm/ppcdebug.h> #include <asm/btext.h> #include <asm/sections.h> +#include <asm/machdep.h> #include "open_pic.h" #ifdef CONFIG_LOGO_LINUX_CLUT224 @@ -185,7 +186,6 @@ extern void enter_prom(void *dummy,...); extern void copy_and_flush(unsigned long dest, unsigned long src, unsigned long size, unsigned long offset); -extern char cmd_line[512]; /* XXX */ unsigned long dev_tree_size; unsigned long _get_PIR(void); @@ -1512,10 +1512,8 @@ prom_init(unsigned long r3, unsigned long r4, unsigned long pp, call_prom(RELOC("getprop"), 4, 1, _prom->chosen, RELOC("bootargs"), p, sizeof(cmd_line)); if (p != NULL && p[0] != 0) - strncpy(RELOC(cmd_line), p, sizeof(cmd_line)); + strlcpy(RELOC(cmd_line), p, sizeof(cmd_line)); } - RELOC(cmd_line[sizeof(cmd_line) - 1]) = 0; - mem = prom_initialize_lmb(mem); diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c index cf165ca5353d..232d667abcc3 100644 --- a/arch/ppc64/kernel/setup.c +++ b/arch/ppc64/kernel/setup.c @@ -477,7 +477,7 @@ static int __init set_preferred_console(void) char *name; /* The user has requested a console so this is already set up. */ - if (strstr(cmd_line, "console=")) + if (strstr(saved_command_line, "console=")) return -EBUSY; prom_stdout = find_path_device(of_stdout_device); diff --git a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h index 0b1970bcf151..d5cf6dc3dcf4 100644 --- a/include/asm-ppc64/machdep.h +++ b/include/asm-ppc64/machdep.h @@ -111,6 +111,7 @@ struct machdep_calls { extern struct machdep_calls ppc_md; #define COMMAND_LINE_SIZE 512 extern char cmd_line[COMMAND_LINE_SIZE]; +extern char saved_command_line[COMMAND_LINE_SIZE]; /* Functions to produce codes on the leds. * The SRC code should be unique for the message category and should |
