aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/partitions/msdos.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/block/partitions/msdos.c b/block/partitions/msdos.c
index 9123f250b425..93e7c1b32edd 100644
--- a/block/partitions/msdos.c
+++ b/block/partitions/msdos.c
@@ -159,8 +159,9 @@ static void parse_extended(struct parsed_partitions *state,
159 /* 159 /*
160 * First process the data partition(s) 160 * First process the data partition(s)
161 */ 161 */
162 for (i=0; i<4; i++, p++) { 162 for (i = 0; i < 4; i++, p++) {
163 sector_t offs, size, next; 163 sector_t offs, size, next;
164
164 if (!nr_sects(p) || is_extended_partition(p)) 165 if (!nr_sects(p) || is_extended_partition(p))
165 continue; 166 continue;
166 167
@@ -194,7 +195,7 @@ static void parse_extended(struct parsed_partitions *state,
194 * It should be a link to the next logical partition. 195 * It should be a link to the next logical partition.
195 */ 196 */
196 p -= 4; 197 p -= 4;
197 for (i=0; i<4; i++, p++) 198 for (i = 0; i < 4; i++, p++)
198 if (nr_sects(p) && is_extended_partition(p)) 199 if (nr_sects(p) && is_extended_partition(p))
199 break; 200 break;
200 if (i == 4) 201 if (i == 4)
@@ -243,8 +244,8 @@ static void parse_solaris_x86(struct parsed_partitions *state,
243 return; 244 return;
244 } 245 }
245 /* Ensure we can handle previous case of VTOC with 8 entries gracefully */ 246 /* Ensure we can handle previous case of VTOC with 8 entries gracefully */
246 max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8; 247 max_nparts = le16_to_cpu(v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8;
247 for (i=0; i<max_nparts && state->next<state->limit; i++) { 248 for (i = 0; i < max_nparts && state->next < state->limit; i++) {
248 struct solaris_x86_slice *s = &v->v_slice[i]; 249 struct solaris_x86_slice *s = &v->v_slice[i];
249 char tmp[3 + 10 + 1 + 1]; 250 char tmp[3 + 10 + 1 + 1];
250 251
@@ -409,7 +410,7 @@ static void parse_minix(struct parsed_partitions *state,
409 /* The first sector of a Minix partition can have either 410 /* The first sector of a Minix partition can have either
410 * a secondary MBR describing its subpartitions, or 411 * a secondary MBR describing its subpartitions, or
411 * the normal boot sector. */ 412 * the normal boot sector. */
412 if (msdos_magic_present (data + 510) && 413 if (msdos_magic_present(data + 510) &&
413 SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */ 414 SYS_IND(p) == MINIX_PARTITION) { /* subpartition table present */
414 char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1]; 415 char tmp[1 + BDEVNAME_SIZE + 10 + 9 + 1];
415 416
@@ -527,6 +528,7 @@ int msdos_partition(struct parsed_partitions *state)
527 for (slot = 1 ; slot <= 4 ; slot++, p++) { 528 for (slot = 1 ; slot <= 4 ; slot++, p++) {
528 sector_t start = start_sect(p)*sector_size; 529 sector_t start = start_sect(p)*sector_size;
529 sector_t size = nr_sects(p)*sector_size; 530 sector_t size = nr_sects(p)*sector_size;
531
530 if (!size) 532 if (!size)
531 continue; 533 continue;
532 if (is_extended_partition(p)) { 534 if (is_extended_partition(p)) {
@@ -537,6 +539,7 @@ int msdos_partition(struct parsed_partitions *state)
537 * sector, although it may not be enough/proper. 539 * sector, although it may not be enough/proper.
538 */ 540 */
539 sector_t n = 2; 541 sector_t n = 2;
542
540 n = min(size, max(sector_size, n)); 543 n = min(size, max(sector_size, n));
541 put_partition(state, slot, start, n); 544 put_partition(state, slot, start, n);
542 545