summaryrefslogtreecommitdiff
path: root/disk/part_efi.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-04-13 09:50:45 -0400
committerTom Rini <trini@konsulko.com>2021-04-13 09:50:45 -0400
commita94ab561e2f49a80d8579930e840b810ab1a1330 (patch)
tree77913e7bd9309afa6b2ddc6f3e3e49827da2025c /disk/part_efi.c
parent3b676a1662ac6b54d1e97ea40a0c41ee0925ffe3 (diff)
parent8c4e3b79bd0bb76eea16869e9666e19047c0d005 (diff)
Merge branch '2021-04-13-assorted-improvements'
- A large assortment of bug fixes, code cleanups and a few feature enhancements.
Diffstat (limited to 'disk/part_efi.c')
-rw-r--r--disk/part_efi.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/disk/part_efi.c b/disk/part_efi.c
index e5636ea7e69..0fb7ff0b6bb 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -692,6 +692,15 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
/* Free pte before allocating again */
free(*gpt_pte);
+ /*
+ * Check that the alternate_lba entry points to the last LBA
+ */
+ if (le64_to_cpu(gpt_head->alternate_lba) != (dev_desc->lba - 1)) {
+ printf("%s: *** ERROR: Misplaced Backup GPT ***\n",
+ __func__);
+ return -1;
+ }
+
if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
gpt_head, gpt_pte) != 1) {
printf("%s: *** ERROR: Invalid Backup GPT ***\n",