[PATCH] mtd: mtdpart: check for subpartitions parsing result
Rafał Miłecki
zajec5 at gmail.com
Tue Jul 18 06:49:27 PDT 2023
From: Rafał Miłecki <rafal at milecki.pl>
parse_mtd_partitions() may return an error so it should be checked and
optionally passed up
Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
drivers/mtd/mtdpart.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 23483db8f30c..f43b5342992a 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -426,7 +426,11 @@ int add_mtd_partitions(struct mtd_info *parent,
mtd_add_partition_attrs(child);
/* Look for subpartitions */
- parse_mtd_partitions(child, parts[i].types, NULL);
+ ret = parse_mtd_partitions(child, parts[i].types, NULL);
+ if (ret) {
+ pr_err("Failed to parse subpartitions: %d\n", ret);
+ goto err_del_partitions;
+ }
cur_offset = child->part.offset + child->part.size;
}
--
2.35.3
More information about the linux-mtd
mailing list