tree:
https://github.com/urjaman/linux c201-5.7-rc1_v1
head: 7e2ed13d58db5bd82626347bc1ea3e22ae6ac514
commit: f6d5961b2bae5cac791a962aecd8d7d1692f769d [8/16] block: partitions: efi: Ignore
bizarre Chromebook GPT partitions
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
smatch warnings:
block/partitions/efi.c:657 find_valid_gpt() warn: inconsistent indenting
vim +657 block/partitions/efi.c
577
578 /**
579 * find_valid_gpt() - Search disk for valid GPT headers and PTEs
580 * @state: disk parsed partitions
581 * @gpt: GPT header ptr, filled on return.
582 * @ptes: PTEs ptr, filled on return.
583 *
584 * Description: Returns 1 if valid, 0 on error.
585 * If valid, returns pointers to newly allocated GPT header and PTEs.
586 * Validity depends on PMBR being valid (or being overridden by the
587 * 'gpt' kernel command line option) and finding either the Primary
588 * GPT header and PTEs valid, or the Alternate GPT header and PTEs
589 * valid. If the Primary GPT header is not valid, the Alternate GPT header
590 * is not checked unless the 'gpt' kernel command line option is passed.
591 * This protects against devices which misreport their size, and forces
592 * the user to decide to use the Alternate GPT.
593 */
594 static int find_valid_gpt(struct parsed_partitions *state, gpt_header **gpt,
595 gpt_entry **ptes)
596 {
597 int good_pgpt = 0, good_agpt = 0, good_pmbr = 0, pgpt_ignored = 0;
598 gpt_header *pgpt = NULL, *agpt = NULL;
599 gpt_entry *pptes = NULL, *aptes = NULL;
600 legacy_mbr *legacymbr;
601 sector_t total_sectors = i_size_read(state->bdev->bd_inode) >> 9;
602 u64 lastlba;
603
604 if (!ptes)
605 return 0;
606
607 lastlba = last_lba(state->bdev);
608 if (!force_gpt) {
609 /* This will be added to the EFI Spec. per Intel after v1.02. */
610 legacymbr = kzalloc(sizeof(*legacymbr), GFP_KERNEL);
611 if (!legacymbr)
612 goto fail;
613
614 read_lba(state, 0, (u8 *)legacymbr, sizeof(*legacymbr));
615 good_pmbr = is_pmbr_valid(legacymbr, total_sectors);
616 kfree(legacymbr);
617
618 if (!good_pmbr)
619 goto fail;
620
621 pr_debug("Device has a %s MBR\n",
622 good_pmbr == GPT_MBR_PROTECTIVE ?
623 "protective" : "hybrid");
624 }
625
626 good_pgpt = is_gpt_valid(state, GPT_PRIMARY_PARTITION_TABLE_LBA,
627 &pgpt, &pptes, &pgpt_ignored);
628 if (good_pgpt)
629 good_agpt = is_gpt_valid(state,
630 le64_to_cpu(pgpt->alternate_lba),
631 &agpt, &aptes, NULL);
632 if (!good_agpt && (force_gpt || pgpt_ignored))
633 good_agpt = is_gpt_valid(state, lastlba, &agpt, &aptes, NULL);
634
635 /* The obviously unsuccessful case */
636 if (!good_pgpt && !good_agpt)
637 goto fail;
638
639 if (!pgpt_ignored)
640 compare_gpts(pgpt, agpt, lastlba);
641
642 /* The good cases */
643 if (good_pgpt) {
644 *gpt = pgpt;
645 *ptes = pptes;
646 kfree(agpt);
647 kfree(aptes);
648 if (!good_agpt)
649 pr_warn("Alternate GPT is invalid, using primary
GPT.\n");
650 return 1;
651 }
652 else if (good_agpt) {
653 *gpt = agpt;
654 *ptes = aptes;
655 kfree(pgpt);
656 kfree(pptes);
657 pr_warn("Primary GPT is %s, using alternate GPT.\n",
658 pgpt_ignored ? "being ignored" : "invalid");
659 return 1;
660 }
661
662 fail:
663 kfree(pgpt);
664 kfree(agpt);
665 kfree(pptes);
666 kfree(aptes);
667 *gpt = NULL;
668 *ptes = NULL;
669 return 0;
670 }
671
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org