mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] cmdlinepart: Allow empty string
Date: Mon,  9 Jul 2018 11:55:13 +0200	[thread overview]
Message-ID: <20180709095513.26524-1-s.hauer@pengutronix.de> (raw)

Currently when cmdlinepart_do_parse() is called with an empty
partitions string then an unnamed partition with size 0 is created.
This is wrong of course and instead no partition should be
created.

With this barebox no longer crashes while booting when all partitions
are deleted on the commandline using "nand0.partitions="

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 lib/cmdlinepart.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/cmdlinepart.c b/lib/cmdlinepart.c
index d7d444115f..5b9f33ca1b 100644
--- a/lib/cmdlinepart.c
+++ b/lib/cmdlinepart.c
@@ -101,6 +101,9 @@ int cmdlinepart_do_parse(const char *devname, const char *parts, loff_t devsize,
 	loff_t offset = 0;
 	int ret;
 
+	if (!parts || *parts == '\0')
+		return 0;
+
 	while (1) {
 		loff_t size = 0;
 
-- 
2.18.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

                 reply	other threads:[~2018-07-09  9:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20180709095513.26524-1-s.hauer@pengutronix.de \
    --to=s.hauer@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