[PATCH] partitions: efi: validate complete GPT entry array
Ahmad Fatoum
a.fatoum at barebox.org
Thu Jul 9 00:33:14 PDT 2026
The Fedora-Workstation-Live-44-1.7.aarch64.iso image advertises 248
slots, which exceeds the 128 partition limit that the barebox EFI
partition parser enforced because of the MAX_PARTITION macro.
The enforcement is not only for creating actual partitions, but also
for computing the CRC, so valid GPTs with a larger entry array are
rejected, even though they have fewer actual partitions.
Read the complete entry array for validation while keeping the
existing export limit when partitions are registered.
Fixes: a576f2f7e5af ("partitions: efi: fix overflow issues while allocating gpt entries")
Assisted-by: Codex:gpt-5.5
Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
common/partitions/efi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index 18a8c4d56632..7ec54a98e335 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -142,7 +142,7 @@ static u32 compute_partitions_entries_size(const gpt_header *gpt)
{
u32 nb_parts, sz_parts, total_size;
- nb_parts = min_t(u32, MAX_PARTITION, le32_to_cpu(gpt->num_partition_entries));
+ nb_parts = le32_to_cpu(gpt->num_partition_entries);
sz_parts = le32_to_cpu(gpt->sizeof_partition_entry);
if (check_mul_overflow(nb_parts, sz_parts, &total_size))
--
2.47.3
More information about the barebox
mailing list