We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8576d01 commit 185ca04Copy full SHA for 185ca04
components/drivers/block/partitions/efi.c
@@ -454,9 +454,13 @@ static rt_bool_t is_gpt_valid(struct rt_blk_disk *disk,
454
*/
455
rt_inline rt_bool_t is_pte_valid(const gpt_entry *pte, const rt_size_t lastlba)
456
{
457
+ rt_uint64_t start = rt_le64_to_cpu(pte->starting_lba);
458
+ rt_uint64_t end = rt_le64_to_cpu(pte->ending_lba);
459
+
460
if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) ||
- rt_le64_to_cpu(pte->starting_lba) > lastlba ||
- rt_le64_to_cpu(pte->ending_lba) > lastlba)
461
+ start > lastlba ||
462
+ end > lastlba ||
463
+ end < start)
464
465
return RT_FALSE;
466
}
0 commit comments