mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] partitions: efi: validate complete GPT entry array
@ 2026-07-09  7:33 Ahmad Fatoum
  2026-07-10 21:42 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-07-09  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-10 21:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-09  7:33 [PATCH] partitions: efi: validate complete GPT entry array Ahmad Fatoum
2026-07-10 21:42 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox