aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/partitions/efi.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
index 0df535fac0aa..1a5ec9a03c00 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
@@ -482,44 +482,42 @@ compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
482 if (!pgpt || !agpt) 482 if (!pgpt || !agpt)
483 return; 483 return;
484 if (le64_to_cpu(pgpt->my_lba) != le64_to_cpu(agpt->alternate_lba)) { 484 if (le64_to_cpu(pgpt->my_lba) != le64_to_cpu(agpt->alternate_lba)) {
485 printk(KERN_WARNING 485 pr_warn("GPT:Primary header LBA != Alt. header alternate_lba\n");
486 "GPT:Primary header LBA != Alt. header alternate_lba\n"); 486 pr_warn("GPT:%lld != %lld\n",
487 printk(KERN_WARNING "GPT:%lld != %lld\n",
488 (unsigned long long)le64_to_cpu(pgpt->my_lba), 487 (unsigned long long)le64_to_cpu(pgpt->my_lba),
489 (unsigned long long)le64_to_cpu(agpt->alternate_lba)); 488 (unsigned long long)le64_to_cpu(agpt->alternate_lba));
490 error_found++; 489 error_found++;
491 } 490 }
492 if (le64_to_cpu(pgpt->alternate_lba) != le64_to_cpu(agpt->my_lba)) { 491 if (le64_to_cpu(pgpt->alternate_lba) != le64_to_cpu(agpt->my_lba)) {
493 printk(KERN_WARNING 492 pr_warn("GPT:Primary header alternate_lba != Alt. header my_lba\n");
494 "GPT:Primary header alternate_lba != Alt. header my_lba\n"); 493 pr_warn("GPT:%lld != %lld\n",
495 printk(KERN_WARNING "GPT:%lld != %lld\n",
496 (unsigned long long)le64_to_cpu(pgpt->alternate_lba), 494 (unsigned long long)le64_to_cpu(pgpt->alternate_lba),
497 (unsigned long long)le64_to_cpu(agpt->my_lba)); 495 (unsigned long long)le64_to_cpu(agpt->my_lba));
498 error_found++; 496 error_found++;
499 } 497 }
500 if (le64_to_cpu(pgpt->first_usable_lba) != 498 if (le64_to_cpu(pgpt->first_usable_lba) !=
501 le64_to_cpu(agpt->first_usable_lba)) { 499 le64_to_cpu(agpt->first_usable_lba)) {
502 printk(KERN_WARNING "GPT:first_usable_lbas don't match.\n"); 500 pr_warn("GPT:first_usable_lbas don't match.\n");
503 printk(KERN_WARNING "GPT:%lld != %lld\n", 501 pr_warn("GPT:%lld != %lld\n",
504 (unsigned long long)le64_to_cpu(pgpt->first_usable_lba), 502 (unsigned long long)le64_to_cpu(pgpt->first_usable_lba),
505 (unsigned long long)le64_to_cpu(agpt->first_usable_lba)); 503 (unsigned long long)le64_to_cpu(agpt->first_usable_lba));
506 error_found++; 504 error_found++;
507 } 505 }
508 if (le64_to_cpu(pgpt->last_usable_lba) != 506 if (le64_to_cpu(pgpt->last_usable_lba) !=
509 le64_to_cpu(agpt->last_usable_lba)) { 507 le64_to_cpu(agpt->last_usable_lba)) {
510 printk(KERN_WARNING "GPT:last_usable_lbas don't match.\n"); 508 pr_warn("GPT:last_usable_lbas don't match.\n");
511 printk(KERN_WARNING "GPT:%lld != %lld\n", 509 pr_warn("GPT:%lld != %lld\n",
512 (unsigned long long)le64_to_cpu(pgpt->last_usable_lba), 510 (unsigned long long)le64_to_cpu(pgpt->last_usable_lba),
513 (unsigned long long)le64_to_cpu(agpt->last_usable_lba)); 511 (unsigned long long)le64_to_cpu(agpt->last_usable_lba));
514 error_found++; 512 error_found++;
515 } 513 }
516 if (efi_guidcmp(pgpt->disk_guid, agpt->disk_guid)) { 514 if (efi_guidcmp(pgpt->disk_guid, agpt->disk_guid)) {
517 printk(KERN_WARNING "GPT:disk_guids don't match.\n"); 515 pr_warn("GPT:disk_guids don't match.\n");
518 error_found++; 516 error_found++;
519 } 517 }
520 if (le32_to_cpu(pgpt->num_partition_entries) != 518 if (le32_to_cpu(pgpt->num_partition_entries) !=
521 le32_to_cpu(agpt->num_partition_entries)) { 519 le32_to_cpu(agpt->num_partition_entries)) {
522 printk(KERN_WARNING "GPT:num_partition_entries don't match: " 520 pr_warn("GPT:num_partition_entries don't match: "
523 "0x%x != 0x%x\n", 521 "0x%x != 0x%x\n",
524 le32_to_cpu(pgpt->num_partition_entries), 522 le32_to_cpu(pgpt->num_partition_entries),
525 le32_to_cpu(agpt->num_partition_entries)); 523 le32_to_cpu(agpt->num_partition_entries));
@@ -527,8 +525,7 @@ compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
527 } 525 }
528 if (le32_to_cpu(pgpt->sizeof_partition_entry) != 526 if (le32_to_cpu(pgpt->sizeof_partition_entry) !=
529 le32_to_cpu(agpt->sizeof_partition_entry)) { 527 le32_to_cpu(agpt->sizeof_partition_entry)) {
530 printk(KERN_WARNING 528 pr_warn("GPT:sizeof_partition_entry values don't match: "
531 "GPT:sizeof_partition_entry values don't match: "
532 "0x%x != 0x%x\n", 529 "0x%x != 0x%x\n",
533 le32_to_cpu(pgpt->sizeof_partition_entry), 530 le32_to_cpu(pgpt->sizeof_partition_entry),
534 le32_to_cpu(agpt->sizeof_partition_entry)); 531 le32_to_cpu(agpt->sizeof_partition_entry));
@@ -536,34 +533,30 @@ compare_gpts(gpt_header *pgpt, gpt_header *agpt, u64 lastlba)
536 } 533 }
537 if (le32_to_cpu(pgpt->partition_entry_array_crc32) != 534 if (le32_to_cpu(pgpt->partition_entry_array_crc32) !=
538 le32_to_cpu(agpt->partition_entry_array_crc32)) { 535 le32_to_cpu(agpt->partition_entry_array_crc32)) {
539 printk(KERN_WARNING 536 pr_warn("GPT:partition_entry_array_crc32 values don't match: "
540 "GPT:partition_entry_array_crc32 values don't match: "
541 "0x%x != 0x%x\n", 537 "0x%x != 0x%x\n",
542 le32_to_cpu(pgpt->partition_entry_array_crc32), 538 le32_to_cpu(pgpt->partition_entry_array_crc32),
543 le32_to_cpu(agpt->partition_entry_array_crc32)); 539 le32_to_cpu(agpt->partition_entry_array_crc32));
544 error_found++; 540 error_found++;
545 } 541 }
546 if (le64_to_cpu(pgpt->alternate_lba) != lastlba) { 542 if (le64_to_cpu(pgpt->alternate_lba) != lastlba) {
547 printk(KERN_WARNING 543 pr_warn("GPT:Primary header thinks Alt. header is not at the end of the disk.\n");
548 "GPT:Primary header thinks Alt. header is not at the end of the disk.\n"); 544 pr_warn("GPT:%lld != %lld\n",
549 printk(KERN_WARNING "GPT:%lld != %lld\n",
550 (unsigned long long)le64_to_cpu(pgpt->alternate_lba), 545 (unsigned long long)le64_to_cpu(pgpt->alternate_lba),
551 (unsigned long long)lastlba); 546 (unsigned long long)lastlba);
552 error_found++; 547 error_found++;
553 } 548 }
554 549
555 if (le64_to_cpu(agpt->my_lba) != lastlba) { 550 if (le64_to_cpu(agpt->my_lba) != lastlba) {
556 printk(KERN_WARNING 551 pr_warn("GPT:Alternate GPT header not at the end of the disk.\n");
557 "GPT:Alternate GPT header not at the end of the disk.\n"); 552 pr_warn("GPT:%lld != %lld\n",
558 printk(KERN_WARNING "GPT:%lld != %lld\n",
559 (unsigned long long)le64_to_cpu(agpt->my_lba), 553 (unsigned long long)le64_to_cpu(agpt->my_lba),
560 (unsigned long long)lastlba); 554 (unsigned long long)lastlba);
561 error_found++; 555 error_found++;
562 } 556 }
563 557
564 if (error_found) 558 if (error_found)
565 printk(KERN_WARNING 559 pr_warn("GPT: Use GNU Parted to correct GPT errors.\n");
566 "GPT: Use GNU Parted to correct GPT errors.\n");
567 return; 560 return;
568} 561}
569 562
@@ -636,7 +629,7 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
636 kfree(agpt); 629 kfree(agpt);
637 kfree(aptes); 630 kfree(aptes);
638 if (!good_agpt) 631 if (!good_agpt)
639 printk(KERN_WARNING "Alternate GPT is invalid, using primary GPT.\n"); 632 pr_warn("Alternate GPT is invalid, using primary GPT.\n");
640 return 1; 633 return 1;
641 } 634 }
642 else if (good_agpt) { 635 else if (good_agpt) {
@@ -644,7 +637,7 @@ static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
644 *ptes = aptes; 637 *ptes = aptes;
645 kfree(pgpt); 638 kfree(pgpt);
646 kfree(pptes); 639 kfree(pptes);
647 printk(KERN_WARNING "Primary GPT is invalid, using alternate GPT.\n"); 640 pr_warn("Primary GPT is invalid, using alternate GPT.\n");
648 return 1; 641 return 1;
649 } 642 }
650 643