[PATCH 1/7] mtd: core: Check partitions for empty string

Teresa Remmet t.remmet at phytec.de
Fri Jul 17 04:13:47 PDT 2015


Make setting partitions a litte bit more robust.

Signed-off-by: Teresa Remmet <t.remmet at phytec.de>
---
 drivers/mtd/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index fda9034..3bdf441 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -386,6 +386,9 @@ static int mtd_partition_set(struct device_d *dev, struct param_d *p, const char
 	struct mtd_info *mtdpart, *tmp;
 	int ret;
 
+	if (!val)
+		return -EINVAL;
+
 	list_for_each_entry_safe(mtdpart, tmp, &mtd->partitions, partitions_entry) {
 		ret = mtd_del_partition(mtdpart);
 		if (ret)
-- 
1.9.1




More information about the barebox mailing list