Browse Source

[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>
GuEe-GUI 1 day ago
parent
commit
2b58dec87b
1 changed files with 5 additions and 0 deletions
  1. 5 0
      components/drivers/block/partitions/efi.c

+ 5 - 0
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;