From 9feb8367999265b8a300cb96e7a66f79b651c820 Mon Sep 17 00:00:00 2001 From: Yoichi Yuasa Date: Tue, 26 Jan 2010 18:07:02 +0900 Subject: MIPS: AR7: use strlcat() for the command line arguments Signed-off-by: Yoichi Yuasa Cc: linux-mips Patchwork: http://patchwork.linux-mips.org/patch/871/ Signed-off-by: Ralf Baechle --- arch/mips/ar7/prom.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'arch/mips/ar7') diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c index f1cfd90a31d7..f5a6ed6deb3f 100644 --- a/arch/mips/ar7/prom.c +++ b/arch/mips/ar7/prom.c @@ -56,22 +56,12 @@ char * __init prom_getcmdline(void) static void __init ar7_init_cmdline(int argc, char *argv[]) { - char *cp; - int actr; - - actr = 1; /* Always ignore argv[0] */ + int i; - cp = &(arcs_cmdline[0]); - while (actr < argc) { - strcpy(cp, argv[actr]); - cp += strlen(argv[actr]); - *cp++ = ' '; - actr++; - } - if (cp != &(arcs_cmdline[0])) { - /* get rid of trailing space */ - --cp; - *cp = '\0'; + for (i = 1; i < argc; i++) { + strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE); + if (i < (argc - 1)) + strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); } } @@ -250,7 +240,7 @@ static void __init console_config(void) else sprintf(console_string, " console=ttyS0,%d%c%c", baud, parity, bits); - strcat(prom_getcmdline(), console_string); + strlcat(arcs_cmdline, console_string, COMMAND_LINE_SIZE); #endif } -- cgit v1.2.2