From: Ken MacLeod <ken@bitsko.slc.ut.us>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_fdt.c: fix parse of byte streams and strings
Date: Thu, 10 Sep 2009 16:41:15 -0500 [thread overview]
Message-ID: <m3ws46fpfo.fsf@bitsko.slc.ut.us> (raw)
Commit 4abd844d8e extended the fdt command parser to handle property
strings which are split across multiple arguments but it was broken for
byte streams and strings. This patch fixes those.
Signed-off-by: Ken MacLeod <ken@bitsko.slc.ut.us>
---
common/cmd_fdt.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 8683772..f0a8f0e 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -580,7 +580,7 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len)
*len = *len + 1;
while (*newp == ' ')
newp++;
- if (*newp != '\0')
+ if (*newp == '\0')
newp = newval[++stridx];
}
if (*newp != ']') {
@@ -593,10 +593,17 @@ static int fdt_parse_prop(char **newval, int count, char *data, int *len)
* convenience (including the terminating '\0').
*/
while (stridx < count) {
- *len = strlen(newp) + 1;
+ size_t length = strlen(newp);
strcpy(data, newp);
+ data += length;
+ *len += length;
newp = newval[++stridx];
+ if (stridx < count) {
+ *data++ = ' ';
+ *len += 1;
+ }
}
+ *len += 1;
}
return 0;
}
--
1.5.4.7
next reply other threads:[~2009-09-10 21:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-10 21:41 Ken MacLeod [this message]
2009-09-11 0:23 ` [U-Boot] [PATCH] cmd_fdt.c: fix parse of byte streams and strings Jerry Van Baren
2009-09-11 16:16 ` Scott Wood
2009-09-11 16:30 ` Jerry Van Baren
2009-09-11 16:39 ` Scott Wood
2009-09-11 16:45 ` Andy Fleming
2009-09-11 16:51 ` Jerry Van Baren
2009-09-11 17:50 ` Ken MacLeod
2009-09-11 17:56 ` Scott Wood
2009-09-11 19:35 ` Jerry Van Baren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3ws46fpfo.fsf@bitsko.slc.ut.us \
--to=ken@bitsko.slc.ut.us \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox