From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] partitions: efi: validate complete GPT entry array
Date: Thu, 9 Jul 2026 09:33:14 +0200 [thread overview]
Message-ID: <20260709073316.522048-1-a.fatoum@barebox.org> (raw)
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
next reply other threads:[~2026-07-09 7:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 7:33 Ahmad Fatoum [this message]
2026-07-10 21:42 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260709073316.522048-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox