summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-07-09 11:51:27 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-07-09 11:51:30 +0200
commit4c7b877a5c90bcf80d42086d246981f0686d1e27 (patch)
treef18389912e43843ec2d393a08e408fd96199957d
parent49b5c5a7e148600a98ce1730c76e23246cbd755c (diff)
downloadbarebox-4c7b877a5c90bcf80d42086d246981f0686d1e27.tar.gz
barebox-4c7b877a5c90bcf80d42086d246981f0686d1e27.tar.xz
cmdlinepart: Allow empty string
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>
-rw-r--r--lib/cmdlinepart.c3
1 files changed, 3 insertions, 0 deletions
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;