[PATCH] cmdlinepart: Allow empty string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux