Skip to contentSkip to conversation

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

PATCH Applied Yoichi Yuasa 2 participants 4 messages Jan 26, 2010 MIPS

lore
Share & tools
lore
#0 lore raw

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

---
 arch/mips/ar7/prom.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)
arch/mips/ar7/prom.c +6 -16
index c1fdd36..43b21c0 100644
@@ -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
 }
 
Signature · 1 line
1.6.6.1
#1 lore raw

PATCH 2/2 MIPS: AR7: replace prom_getcmdline() to arcs_cmdline[]

---
 arch/mips/ar7/prom.c |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
arch/mips/ar7/prom.c +1 -6
index 43b21c0..4d75ff1 100644
@@ -49,11 +49,6 @@ char *prom_getenv(const char *name)
 }
 EXPORT_SYMBOL(prom_getenv);
 
-char * __init prom_getcmdline(void)
-{
-	return &(arcs_cmdline[0]);
-}
-
 static void  __init ar7_init_cmdline(int argc, char *argv[])
 {
 	int i;
@@ -206,7 +201,7 @@ static void __init console_config(void)
 	char parity = '\0', bits = '\0', flow = '\0';
 	char *s, *p;
 
-	if (strstr(prom_getcmdline(), "console="))
+	if (strstr(arcs_cmdline, "console="))
 		return;
 
 	s = prom_getenv("modetty0");
Signature · 1 line
1.6.6.1
#2 lore raw

Re: [PATCH 2/2] MIPS: AR7: replace prom_getcmdline() to arcs_cmdline[]

On Tue, Jan 26, 2010 at 06:08:34PM +0900, Yoichi Yuasa wrote:

Thanks, also queued for 2.6.34.

Ralf