diff options
-rw-r--r-- | drivers/mtd/redboot.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c index b5259215f6d7..035cd9b0cc08 100644 --- a/drivers/mtd/redboot.c +++ b/drivers/mtd/redboot.c | |||
@@ -96,7 +96,19 @@ static int parse_redboot_partitions(struct mtd_info *master, | |||
96 | */ | 96 | */ |
97 | if (swab32(buf[i].size) == master->erasesize) { | 97 | if (swab32(buf[i].size) == master->erasesize) { |
98 | int j; | 98 | int j; |
99 | for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) { | 99 | for (j = 0; j < numslots; ++j) { |
100 | |||
101 | /* A single 0xff denotes a deleted entry. | ||
102 | * Two of them in a row is the end of the table. | ||
103 | */ | ||
104 | if (buf[j].name[0] == 0xff) { | ||
105 | if (buf[j].name[1] == 0xff) { | ||
106 | break; | ||
107 | } else { | ||
108 | continue; | ||
109 | } | ||
110 | } | ||
111 | |||
100 | /* The unsigned long fields were written with the | 112 | /* The unsigned long fields were written with the |
101 | * wrong byte sex, name and pad have no byte sex. | 113 | * wrong byte sex, name and pad have no byte sex. |
102 | */ | 114 | */ |
@@ -126,8 +138,13 @@ static int parse_redboot_partitions(struct mtd_info *master, | |||
126 | for (i = 0; i < numslots; i++) { | 138 | for (i = 0; i < numslots; i++) { |
127 | struct fis_list *new_fl, **prev; | 139 | struct fis_list *new_fl, **prev; |
128 | 140 | ||
129 | if (buf[i].name[0] == 0xff) | 141 | if (buf[i].name[0] == 0xff) { |
130 | continue; | 142 | if (buf[i].name[1] == 0xff) { |
143 | break; | ||
144 | } else { | ||
145 | continue; | ||
146 | } | ||
147 | } | ||
131 | if (!redboot_checksum(&buf[i])) | 148 | if (!redboot_checksum(&buf[i])) |
132 | break; | 149 | break; |
133 | 150 | ||