* [PATCH] partitions: efi: only warn about valid GPT entries beyond the limit
@ 2026-08-26 9:39 Ahmad Fatoum
2026-08-28 13:00 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-26 9:39 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
GPT headers may describe more than the customary 128 partition entries.
xorriso for example writes a 248 entry table for hybrid ISOs like the
Alpine Linux images, of which only three entries are in use. barebox
would then warn on every boot:
WARNING: GPT has more partitions than we support (248) > max partition number (128)
although it could handle every partition that actually exists. Iterate
over all entries instead and only warn about the valid ones that we
have to ignore.
Assisted-by: Claude:fable-5
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/partitions/efi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/common/partitions/efi.c b/common/partitions/efi.c
index 7ec54a98e335..d9f0e1a00d45 100644
--- a/common/partitions/efi.c
+++ b/common/partitions/efi.c
@@ -626,12 +626,6 @@ static struct partition_desc *efi_partition(void *buf, struct block_device *blk)
nb_part = le32_to_cpu(gpt->num_partition_entries);
- if (nb_part > MAX_PARTITION) {
- dev_warn(blk->dev, "GPT has more partitions than we support (%d) > max partition number (%d)\n",
- nb_part, MAX_PARTITION);
- nb_part = MAX_PARTITION;
- }
-
snprintf(blk->cdev.diskuuid, sizeof(blk->cdev.diskuuid), "%pUl", &gpt->disk_guid);
add_gpt_diskuuid_param(epd, blk);
@@ -641,6 +635,12 @@ static struct partition_desc *efi_partition(void *buf, struct block_device *blk)
continue;
}
+ if (i >= MAX_PARTITION) {
+ dev_warn(blk->dev, "ignoring GPT partition %d beyond the %d we support\n",
+ i + 1, MAX_PARTITION);
+ continue;
+ }
+
epart = xzalloc(sizeof(*epart));
epart->pte = &ptes[i];
pentry = &epart->part;
--
2.47.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] partitions: efi: only warn about valid GPT entries beyond the limit
2026-08-26 9:39 [PATCH] partitions: efi: only warn about valid GPT entries beyond the limit Ahmad Fatoum
@ 2026-08-28 13:00 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-08-28 13:00 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 26 Aug 2026 11:39:36 +0200, Ahmad Fatoum wrote:
> GPT headers may describe more than the customary 128 partition entries.
> xorriso for example writes a 248 entry table for hybrid ISOs like the
> Alpine Linux images, of which only three entries are in use. barebox
> would then warn on every boot:
>
> WARNING: GPT has more partitions than we support (248) > max partition number (128)
>
> [...]
Applied, thanks!
[1/1] partitions: efi: only warn about valid GPT entries beyond the limit
https://git.pengutronix.de/cgit/barebox/commit/?id=184f39a5975b (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-28 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 9:39 [PATCH] partitions: efi: only warn about valid GPT entries beyond the limit Ahmad Fatoum
2026-08-28 13:00 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox