From: Clement Leger <cleger@kalray.eu>
To: Sascha Hauer <s.hauer@pengutronix.de>, barebox@lists.infradead.org
Cc: Clement Leger <cleger@kalray.eu>
Subject: [PATCH] common: oftree: trim leading spaces from bootargs
Date: Fri, 20 Mar 2020 17:07:20 +0100 [thread overview]
Message-ID: <20200320160720.27134-1-cleger@kalray.eu> (raw)
When barebox concatenates all dynamic bootargs string for linux, if they
are empty, the resulting string might be composed of only spaces.
Currently, there is no check for such string and it leads to
overwriting bootargs in the device tree by an empty string. To avoid
this behavior, use skip_spaces to trim leading spaces and then check if
the string is empty. If so, simply returns and don't patch device tree
bootargs.
Signed-off-by: Clement Leger <cleger@kalray.eu>
---
common/oftree.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common/oftree.c b/common/oftree.c
index 09cb66021..36906e86f 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -151,6 +151,10 @@ static int of_fixup_bootargs(struct device_node *root, void *unused)
if (!str)
return 0;
+ str = skip_spaces(str);
+ if (strlen(str) == 0)
+ return 0;
+
node = of_create_node(root, "/chosen");
if (!node)
return -ENOMEM;
--
2.15.0.276.g89ea799
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2020-03-20 16:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-20 16:07 Clement Leger [this message]
2020-03-23 7:19 ` 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=20200320160720.27134-1-cleger@kalray.eu \
--to=cleger@kalray.eu \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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