linux-mips
[Top] [All Lists]

[PATCH 1/2] MIPS: AR7: use strlcat() for the command line arguments

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 1/2] MIPS: AR7: use strlcat() for the command line arguments
From: Yoichi Yuasa <yuasa@linux-mips.org>
Date: Tue, 26 Jan 2010 18:07:02 +0900
Cc: yuasa@linux-mips.org, linux-mips <linux-mips@linux-mips.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:date:from:to:cc :subject:message-id:x-mailer:mime-version:content-type :content-transfer-encoding; bh=8HlYlnVxSmU7qCwYUZov9SKMyI/Wki4UCqXqCIM3QFs=; b=bKv9hg97ikzHl3ZgHHlbIPpf8u3zkPlkjenG4FbkNWNiISEjhx8EZ03/UkE7XzgpbJ NZGSNmG+dYJ7TVSrtNd2Ms2K8t0OPOgpUMse25Wek9WmHIJ6f+m15Sg9S1L7m1MKIS4b 8CsMH04Pew4po7uo3h9s7S0P4Z9Ux6HRzyODA=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; b=Otjora0Ibyfex22eeT3YzZD3H0f8AF2qv5yDXiuctFULZdMiISV5ItabaEEQ59rP0f OAPHM8Hdm/WIrychfQ0kEK2vguY9Fw0xYaQujiQw6YgmYoA2SvXQIWuw7Reelk1qA2KD fDKypMXcIpcww0kgCjoKW9aV70x7LVaAcxT3s=
Sender: linux-mips-bounce@linux-mips.org
Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
 arch/mips/ar7/prom.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
index c1fdd36..43b21c0 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
 }
 
-- 
1.6.6.1


<Prev in Thread] Current Thread [Next in Thread>