| To: | Ralf Baechle <ralf@linux-mips.org> |
|---|---|
| Subject: | [PATCH] MIPS: Cobalt use strlcat() for the command line arguments |
| From: | Yoichi Yuasa <yuasa@linux-mips.org> |
| Date: | Thu, 24 Dec 2009 17:06:34 +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=bCr2UgI2anTxs62+3GHXH/TtVzKBRwpZAlqJGJmBE00=; b=c+/8coFvVjQ9DulZ+v/9fj67vZbMjF8BdRnjfgCh2qhiunL9bLmKCygrO1Ud1lpvGM iJpLVymWpD3Brf7nS4VlMcd43v1cA1dmGFuDxqmp5kDWqQXpxJbmVxMYARKI/SKGTzEF oYMGVwD457++tm1swDDmnRecFZaY3qyyNyzvY= |
| 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=d9Isb4cnVuuunN3U62nXvEeVKaUHJdHh12NEfTAushLmMGPfpOa/sPNfSfRED+d1b+ 3Ck2X0r8WM/V/b/FlCyk3brwMyaU7DFaGFkxBPNvL+OQ/bCyVWGssHdmT6Ww7LQ+5Nqe VebHr9bxZy0FXib4fxyb006eVry/wGjDlthJY= |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| Sender: | linux-mips-bounce@linux-mips.org |
Tested with CoLo v1.22
Signed-off-by: Yoichi Yuasa <yuasa@linux-mips.org>
---
arch/mips/cobalt/setup.c | 24 ++++++++----------------
1 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c
index b516442..ec3b2c4 100644
--- a/arch/mips/cobalt/setup.c
+++ b/arch/mips/cobalt/setup.c
@@ -97,26 +97,18 @@ void __init plat_mem_setup(void)
void __init prom_init(void)
{
- int narg, indx, posn, nchr;
unsigned long memsz;
+ int argc, i;
char **argv;
memsz = fw_arg0 & 0x7fff0000;
- narg = fw_arg0 & 0x0000ffff;
-
- if (narg) {
- arcs_cmdline[0] = '\0';
- argv = (char **) fw_arg1;
- posn = 0;
- for (indx = 1; indx < narg; ++indx) {
- 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;
- }
+ argc = fw_arg0 & 0x0000ffff;
+ argv = (char **)fw_arg1;
+
+ for (i = 1; i < argc; i++) {
+ strlcat(arcs_cmdline, argv[i], COMMAND_LINE_SIZE);
+ if (i < (argc - 1))
+ strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
}
add_memory_region(0x0, memsz, BOOT_MEM_RAM);
--
1.6.5.7
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: [PATCH 2/5] MIPS: remove unused powertv ptv_memsize, David VomLehn |
|---|---|
| Next by Date: | Re: [PATCH 1/2] bcm63xx: fix tabs/space damaged board_bcm963xx.c, Ralf Baechle |
| Previous by Thread: | [PATCH] powertv: streamline access to platform device registers, David VomLehn |
| Next by Thread: | Re: [PATCH] MIPS: Cobalt use strlcat() for the command line arguments, Ralf Baechle |
| Indexes: | [Date] [Thread] [Top] [All Lists] |