aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/redboot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/redboot.c')
-rw-r--r--drivers/mtd/redboot.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index a459ffa1e676..a61351f88ec0 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -94,7 +94,16 @@ static int parse_redboot_partitions(struct mtd_info *master,
94 * (NOTE: this is 'size' not 'data_length'; size is 94 * (NOTE: this is 'size' not 'data_length'; size is
95 * the full size of the entry.) 95 * the full size of the entry.)
96 */ 96 */
97 if (swab32(buf[i].size) == master->erasesize) { 97
98 /* RedBoot can combine the FIS directory and
99 config partitions into a single eraseblock;
100 we assume wrong-endian if either the swapped
101 'size' matches the eraseblock size precisely,
102 or if the swapped size actually fits in an
103 eraseblock while the unswapped size doesn't. */
104 if (swab32(buf[i].size) == master->erasesize ||
105 (buf[i].size > master->erasesize
106 && swab32(buf[i].size) < master->erasesize)) {
98 int j; 107 int j;
99 /* Update numslots based on actual FIS directory size */ 108 /* Update numslots based on actual FIS directory size */
100 numslots = swab32(buf[i].size) / sizeof (struct fis_image_desc); 109 numslots = swab32(buf[i].size) / sizeof (struct fis_image_desc);
@@ -122,7 +131,7 @@ static int parse_redboot_partitions(struct mtd_info *master,
122 swab32s(&buf[j].desc_cksum); 131 swab32s(&buf[j].desc_cksum);
123 swab32s(&buf[j].file_cksum); 132 swab32s(&buf[j].file_cksum);
124 } 133 }
125 } else { 134 } else if (buf[i].size < master->erasesize) {
126 /* Update numslots based on actual FIS directory size */ 135 /* Update numslots based on actual FIS directory size */
127 numslots = buf[i].size / sizeof(struct fis_image_desc); 136 numslots = buf[i].size / sizeof(struct fis_image_desc);
128 } 137 }