diff options
author | Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com> | 2019-09-04 10:41:22 +0200 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2019-09-19 23:43:27 +0200 |
commit | dc76900021b880820adf981bb7b1cf5ff3ffe1fd (patch) | |
tree | d3de7575b11079f9b41cc0a289d74281c07a4ce4 /target/linux/generic/files/drivers/mtd/mtdsplit | |
parent | 205e0939f0a141a1524d94eaf84407ddcb6a1a09 (diff) | |
download | upstream-dc76900021b880820adf981bb7b1cf5ff3ffe1fd.tar.gz upstream-dc76900021b880820adf981bb7b1cf5ff3ffe1fd.tar.bz2 upstream-dc76900021b880820adf981bb7b1cf5ff3ffe1fd.zip |
kernel: Correctly search for the FIT image in mtd partition.
Previously all iterations of the loop checked offset=0 in the partition.
Signed-off-by: Fredrik Olofsson <fredrik.olofsson@anyfinetworks.com>
Diffstat (limited to 'target/linux/generic/files/drivers/mtd/mtdsplit')
-rw-r--r-- | target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c | 4 |
1 files 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 f9e5e53a95..d206fecd5b 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c @@ -60,8 +60,8 @@ mtdsplit_fit_parse(struct mtd_info *mtd, hdr_len = sizeof(struct fdt_header); /* Parse the MTD device & search for the FIT image location */ - for(offset = 0; offset < mtd->size; offset += mtd->erasesize) { - ret = mtd_read(mtd, 0, hdr_len, &retlen, (void*) &hdr); + for(offset = 0; offset + hdr_len < mtd->size; offset += mtd->erasesize) { + ret = mtd_read(mtd, offset, hdr_len, &retlen, (void*) &hdr); if (ret) { pr_err("read error in \"%s\" at offset 0x%llx\n", mtd->name, (unsigned long long) offset); |