mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] cmdlinepart: Allow empty string
@ 2018-07-09  9:55 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2018-07-09  9:55 UTC (permalink / raw)
  To: Barebox List

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-09  9:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-09  9:55 [PATCH] cmdlinepart: Allow empty string Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox