summaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/randomalloc.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-08-16 09:04:28 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-08-16 09:04:28 +0200
commit2dec48c32a349e51920b6a53b464982db4ed1563 (patch)
tree2b9cccff8a823d9c6c1a06865f788b183f72d48f /drivers/firmware/efi/libstub/randomalloc.c
parentcea45a3bd2dd4d9c35581328f571afd32b3c9f48 (diff)
parent7c60610d476766e128cc4284bb6349732cbd6606 (diff)
Merge 5.14-rc6 into usb-next
We need the USB fix in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/randomalloc.c')
-rw-r--r--drivers/firmware/efi/libstub/randomalloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/firmware/efi/libstub/randomalloc.c b/drivers/firmware/efi/libstub/randomalloc.c
index a408df474d83..724155b9e10d 100644
--- a/drivers/firmware/efi/libstub/randomalloc.c
+++ b/drivers/firmware/efi/libstub/randomalloc.c
@@ -30,6 +30,8 @@ static unsigned long get_entry_num_slots(efi_memory_desc_t *md,
region_end = min(md->phys_addr + md->num_pages * EFI_PAGE_SIZE - 1,
(u64)ULONG_MAX);
+ if (region_end < size)
+ return 0;
first_slot = round_up(md->phys_addr, align);
last_slot = round_down(region_end - size + 1, align);