From 2b58dec87b584aa7ded6e8c736498716f8d29cd0 Mon Sep 17 00:00:00 2001 From: GuEe-GUI <2991707448@qq.com> Date: Tue, 17 Mar 2026 19:39:50 +0800 Subject: [PATCH] [dm][block] fixup the EFI partition checked in 32bits Link: https://github.com/RT-Thread/rt-thread/issues/11260 Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/block/partitions/efi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/drivers/block/partitions/efi.c b/components/drivers/block/partitions/efi.c index a68a1470a1..22f6ba1659 100644 --- a/components/drivers/block/partitions/efi.c +++ b/components/drivers/block/partitions/efi.c @@ -411,6 +411,11 @@ static rt_bool_t is_gpt_valid(struct rt_blk_disk *disk, pt_size = (rt_uint64_t)rt_le32_to_cpu((*gpt)->num_partition_entries) * rt_le32_to_cpu((*gpt)->sizeof_partition_entry); + if (pt_size > (rt_uint64_t)RT_UINT32_MAX) + { + goto _fail; + } + if (!(*ptes = alloc_read_gpt_entries(disk, *gpt))) { goto _fail;