diff options
author | Alexander Graf <agraf@suse.de> | 2018-03-15 15:08:16 +0100 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2018-04-04 11:09:06 +0200 |
commit | 813468cdbd7287f0b2e38f9702aa3eee37b1c5b5 (patch) | |
tree | 9376987fe5b8ecc3cc90105ae64e4a8a8e82452f /lib/efi_loader/efi_runtime.c | |
parent | 8e475064097d182191129e31846c585421f0f85a (diff) |
efi_loader: Fix return value for efi_add_runtime_mmio
The efi_add_runtime_mmio function incorrectly returned the added
address as return value rather than EFI_SUCCESS. Fix it by checking
the return value of efi_add_memory_map properly.
Fixes: f057cfef5dc ("efi_loader: exit status for efi_reset_system_init")
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader/efi_runtime.c')
-rw-r--r-- | lib/efi_loader/efi_runtime.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 0888316140..8558124c0a 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -349,13 +349,13 @@ static efi_status_t EFIAPI efi_set_virtual_address_map( efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len) { struct efi_runtime_mmio_list *newmmio; - efi_status_t ret; - u64 pages = (len + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT; - ret = efi_add_memory_map(*(uintptr_t *)mmio_ptr, pages, EFI_MMAP_IO, - false); - if (ret != EFI_SUCCESS) - return ret; + uint64_t addr = *(uintptr_t *)mmio_ptr; + uint64_t retaddr; + + retaddr = efi_add_memory_map(addr, pages, EFI_MMAP_IO, false); + if (retaddr != addr) + return EFI_OUT_OF_RESOURCES; newmmio = calloc(1, sizeof(*newmmio)); if (!newmmio) @@ -365,7 +365,7 @@ efi_status_t efi_add_runtime_mmio(void *mmio_ptr, u64 len) newmmio->len = len; list_add_tail(&newmmio->link, &efi_runtime_mmio); - return ret; + return EFI_SUCCESS; } /* |