[openwrt/openwrt] kernel: mtdsplit: fix fit rootfs_data split
LEDE Commits
lede-commits at lists.infradead.org
Sun Jul 7 06:00:29 PDT 2024
981213 pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/7117ebab0bc681aa6657202dd44c6b562335901b
commit 7117ebab0bc681aa6657202dd44c6b562335901b
Author: Chuanhong Guo <gch981213 at gmail.com>
AuthorDate: Fri Jun 28 16:31:59 2024 +0800
kernel: mtdsplit: fix fit rootfs_data split
fit size should be rounded up instead of rounding down first and adding
a block. Otherwise the calculated size is one block more than needed
when fit size is exactly multiples of one block size.
Fixes: 9a863f803ec1 ("kernel: mtdsplit: add support for FIT image")
Signed-off-by: Chuanhong Guo <gch981213 at gmail.com>
Signed-off-by: Qingfang Deng <qingfang.deng at siflower.com.cn>
---
target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c
index 3b71597d23..a271a676e1 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c
@@ -278,7 +278,7 @@ mtdsplit_fit_parse(struct mtd_info *mtd,
parts[0].name = KERNEL_PART_NAME;
parts[0].offset = fit_offset;
- parts[0].size = mtd_rounddown_to_eb(fit_size + offset_start, mtd) + mtd->erasesize;
+ parts[0].size = mtd_roundup_to_eb(fit_size + offset_start, mtd);
if (type == MTDSPLIT_PART_TYPE_UBI)
parts[1].name = UBI_PART_NAME;
@@ -327,7 +327,7 @@ mtdsplit_fit_parse(struct mtd_info *mtd,
return -ENOMEM;
parts[0].name = ROOTFS_SPLIT_NAME;
- parts[0].offset = fit_offset + mtd_rounddown_to_eb(max_size, mtd) + mtd->erasesize;
+ parts[0].offset = fit_offset + mtd_roundup_to_eb(max_size, mtd);
parts[0].size = mtd->size - parts[0].offset;
*pparts = parts;
More information about the lede-commits
mailing list