aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/partitions/efi.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 1a5ec9a03c00..1eb09ee5311b 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -186,6 +186,7 @@ invalid:
186 */ 186 */
187static int is_pmbr_valid(legacy_mbr *mbr, sector_t total_sectors) 187static int is_pmbr_valid(legacy_mbr *mbr, sector_t total_sectors)
188{ 188{
189 uint32_t sz = 0;
189 int i, part = 0, ret = 0; /* invalid by default */ 190 int i, part = 0, ret = 0; /* invalid by default */
190 191
191 if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE) 192 if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE)
@@ -216,12 +217,15 @@ check_hybrid:
216 /* 217 /*
217 * Protective MBRs take up the lesser of the whole disk 218 * Protective MBRs take up the lesser of the whole disk
218 * or 2 TiB (32bit LBA), ignoring the rest of the disk. 219 * or 2 TiB (32bit LBA), ignoring the rest of the disk.
220 * Some partitioning programs, nonetheless, choose to set
221 * the size to the maximum 32-bit limitation, disregarding
222 * the disk size.
219 * 223 *
220 * Hybrid MBRs do not necessarily comply with this. 224 * Hybrid MBRs do not necessarily comply with this.
221 */ 225 */
222 if (ret == GPT_MBR_PROTECTIVE) { 226 if (ret == GPT_MBR_PROTECTIVE) {
223 if (le32_to_cpu(mbr->partition_record[part].size_in_lba) != 227 sz = le32_to_cpu(mbr->partition_record[part].size_in_lba);
224 min((uint32_t) total_sectors - 1, 0xFFFFFFFF)) 228 if (sz != (uint32_t) total_sectors - 1 && sz != 0xFFFFFFFF)
225 ret = 0; 229 ret = 0;
226 } 230 }
227done: 231done: