[source] kernel: mtdsplit_uimage: fix rootfs offset

LEDE Commits lede-commits at lists.infradead.org
Sat Oct 15 02:06:39 PDT 2016


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/35073d47bb91fc0066a08c85c9206a6338a19b7e

commit 35073d47bb91fc0066a08c85c9206a6338a19b7e
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sun Oct 2 19:18:56 2016 +0200

    kernel: mtdsplit_uimage: fix rootfs offset
    
    The return value of the find_header function need to be added to the
    uimage_size, otherwise mtd_find_rootfs_from() might search for a rootfs
    within a custom header and fails.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
index a50735a..3ddb71b 100644
--- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
+++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c
@@ -126,7 +126,7 @@ static int __mtdsplit_parse_uimage(struct mtd_info *master,
 		}
 		header = (struct uimage_header *)(buf + ret);
 
-		uimage_size = sizeof(*header) + be32_to_cpu(header->ih_size);
+		uimage_size = sizeof(*header) + be32_to_cpu(header->ih_size) + ret;
 		if ((offset + uimage_size) > master->size) {
 			pr_debug("uImage exceeds MTD device \"%s\"\n",
 				 master->name);



More information about the lede-commits mailing list