Skip to content

Commit

Permalink
efi: runtime: Fix potential overflow of soft-reserved region size
Browse files Browse the repository at this point in the history
[ Upstream commit de1034b ]

md_size will have been narrowed if we have >= 4GB worth of pages in a
soft-reserved region.

Signed-off-by: Andrew Bresticker <abrestic@rivosinc.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
abrestic-rivos authored and gregkh committed Mar 1, 2024
1 parent 3dce50c commit cf3d681
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion drivers/firmware/efi/arm-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static int __init arm_enable_runtime_services(void)
efi_memory_desc_t *md;

for_each_efi_memory_desc(md) {
int md_size = md->num_pages << EFI_PAGE_SHIFT;
u64 md_size = md->num_pages << EFI_PAGE_SHIFT;
struct resource *res;

if (!(md->attribute & EFI_MEMORY_SP))
Expand Down
2 changes: 1 addition & 1 deletion drivers/firmware/efi/riscv-runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int __init riscv_enable_runtime_services(void)
efi_memory_desc_t *md;

for_each_efi_memory_desc(md) {
int md_size = md->num_pages << EFI_PAGE_SHIFT;
u64 md_size = md->num_pages << EFI_PAGE_SHIFT;
struct resource *res;

if (!(md->attribute & EFI_MEMORY_SP))
Expand Down

0 comments on commit cf3d681

Please sign in to comment.