Commit 0833c76b authored by Yoichi Yuasa's avatar Yoichi Yuasa Committed by Ralf Baechle

MIPS: Cobalt use strlcat() for the command line arguments

Tested with CoLo v1.22
Signed-off-by: default avatarYoichi Yuasa <yuasa@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/807/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent c6a3c851
...@@ -97,26 +97,18 @@ void __init plat_mem_setup(void) ...@@ -97,26 +97,18 @@ void __init plat_mem_setup(void)
void __init prom_init(void) void __init prom_init(void)
{ {
int narg, indx, posn, nchr;
unsigned long memsz; unsigned long memsz;
int argc, i;
char **argv; char **argv;
memsz = fw_arg0 & 0x7fff0000; memsz = fw_arg0 & 0x7fff0000;
narg = fw_arg0 & 0x0000ffff; argc = fw_arg0 & 0x0000ffff;
argv = (char **)fw_arg1;
if (narg) {
arcs_cmdline[0] = '\0'; for (i = 1; i < argc; i++) {
argv = (char **) fw_arg1; strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
posn = 0; if (i < (argc - 1))
for (indx = 1; indx < narg; ++indx) { strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
nchr = strlen(argv[indx]);
if (posn + 1 + nchr + 1 > sizeof(arcs_cmdline))
break;
if (posn)
arcs_cmdline[posn++] = ' ';
strcpy(arcs_cmdline + posn, argv[indx]);
posn += nchr;
}
} }
add_memory_region(0x0, memsz, BOOT_MEM_RAM); add_memory_region(0x0, memsz, BOOT_MEM_RAM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment