diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2023-09-27 22:26:57 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-10-16 10:50:32 +0200 |
commit | 5c2f7727d437cd42033d13ebc8b3d74b9fe65712 (patch) | |
tree | 5815a8e619dd7a90be4af2740e3c6105bb048a01 /drivers/mtd/mtdpart.c | |
parent | 8baba8d52ff5081e8c3c383132af269ba8e2f458 (diff) | |
download | lwn-5c2f7727d437cd42033d13ebc8b3d74b9fe65712.tar.gz lwn-5c2f7727d437cd42033d13ebc8b3d74b9fe65712.zip |
mtd: mtdpart: check for subpartitions parsing result
parse_mtd_partitions() may return an error so it should be checked and
optionally passed up
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230927202657.27169-1-zajec5@gmail.com
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r-- | drivers/mtd/mtdpart.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 23483db8f30c..6811a714349d 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 < 0) { + pr_err("Failed to parse subpartitions: %d\n", ret); + goto err_del_partitions; + } cur_offset = child->part.offset + child->part.size; } |