Commit 11192146 authored by Rod Whitby's avatar Rod Whitby Committed by David Woodhouse

[MTD] Fix RedBoot partition parsing regression harder.

Correct the location of the recalculation of the FIS directory size,
and also add the same recalculation for the byte-swapped case.
Signed-off-by: default avatarRod Whitby <rod@whitby.id.au>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent a2593247
...@@ -96,6 +96,8 @@ static int parse_redboot_partitions(struct mtd_info *master, ...@@ -96,6 +96,8 @@ static int parse_redboot_partitions(struct mtd_info *master,
*/ */
if (swab32(buf[i].size) == master->erasesize) { if (swab32(buf[i].size) == master->erasesize) {
int j; int j;
/* Update numslots based on actual FIS directory size */
numslots = swab32(buf[i].size) / sizeof (struct fis_image_desc);
for (j = 0; j < numslots; ++j) { for (j = 0; j < numslots; ++j) {
/* A single 0xff denotes a deleted entry. /* A single 0xff denotes a deleted entry.
...@@ -120,11 +122,11 @@ static int parse_redboot_partitions(struct mtd_info *master, ...@@ -120,11 +122,11 @@ static int parse_redboot_partitions(struct mtd_info *master,
swab32s(&buf[j].desc_cksum); swab32s(&buf[j].desc_cksum);
swab32s(&buf[j].file_cksum); swab32s(&buf[j].file_cksum);
} }
} else {
/* Update numslots based on actual FIS directory size */
numslots = buf[i].size / sizeof(struct fis_image_desc);
} }
break; break;
} else if (buf[i].size != -1) {
/* re-calculate of real numslots */
numslots = buf[i].size / sizeof(struct fis_image_desc);
} }
} }
if (i == numslots) { if (i == numslots) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment