From: Marc Kleine-Budde <mkl@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/3] fixup! state: add support for fixed length strings
Date: Thu, 25 Jun 2015 14:47:11 +0200 [thread overview]
Message-ID: <1435236431-11021-3-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1435236431-11021-1-git-send-email-mkl@pengutronix.de>
Only export default value if set. This may cause an NULL pointer deref.
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
common/state.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/common/state.c b/common/state.c
index 688c85cf0e7d..124332022662 100644
--- a/common/state.c
+++ b/common/state.c
@@ -445,14 +445,17 @@ static int state_string_export(struct state_variable *var,
struct state_string *string = to_state_string(var);
int ret = 0;
- if (string->value_default || conv == STATE_CONVERT_FIXUP) {
+ if (string->value_default) {
ret = of_set_property(node, "default", string->value_default,
strlen(string->value_default) + 1, 1);
- if (ret || conv == STATE_CONVERT_FIXUP)
+ if (ret)
return ret;
}
+ if (conv == STATE_CONVERT_FIXUP)
+ return 0;
+
if (string->value)
ret = of_set_property(node, "value", string->value,
strlen(string->value) + 1, 1);
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-06-25 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-25 12:47 [PATCH 1/3] state: fixup: only export default value during fixup if set Marc Kleine-Budde
2015-06-25 12:47 ` [PATCH 2/3] fixup! state: add support for fixed length strings Marc Kleine-Budde
2015-06-25 12:47 ` Marc Kleine-Budde [this message]
2015-06-26 9:27 ` [PATCH 1/3] state: fixup: only export default value during fixup if set Sascha Hauer
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=1435236431-11021-3-git-send-email-mkl@pengutronix.de \
--to=mkl@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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