aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorFredrik Olofsson <fredrik.olofsson@anyfinetworks.com>2019-09-04 10:41:22 +0200
committerPetr Štetiar <ynezz@true.cz>2019-10-09 21:05:00 +0200
commit4abf456b4a828b2aa4094f8fd505741541bbacb7 (patch)
tree837edf3fc37254db94e7ca10f7ce567573aa9cb2 /target/linux
parent830000855eb6ad0991ec943e8ec2fcd7670b0038 (diff)
downloadupstream-4abf456b4a828b2aa4094f8fd505741541bbacb7.tar.gz
upstream-4abf456b4a828b2aa4094f8fd505741541bbacb7.tar.bz2
upstream-4abf456b4a828b2aa4094f8fd505741541bbacb7.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> (cherry picked from commit dc76900021b880820adf981bb7b1cf5ff3ffe1fd)
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_fit.c4
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);