]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: optional pointer for ConvertPointer
authorHeinrich Schuchardt <xypron.glpk@gmx.de>
Tue, 24 Mar 2020 16:52:40 +0000 (17:52 +0100)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Sat, 11 Jul 2020 21:14:17 +0000 (23:14 +0200)
If the EFI_OPTIONAL_PTR is set in DebugDisposition, a NULL pointer does not
constitute an invalid parameter.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
include/efi_api.h
lib/efi_loader/efi_runtime.c

index 759d9118758e7db4dc23a5e61ff7d28a06351945..5744f6aed86d16b6a4b5747be6a729bc52402c87 100644 (file)
@@ -251,6 +251,8 @@ struct efi_rt_properties_table {
        u32 runtime_services_supported;
 };
 
+#define EFI_OPTIONAL_PTR       0x00000001
+
 struct efi_runtime_services {
        struct efi_table_hdr hdr;
        efi_status_t (EFIAPI *get_time)(struct efi_time *time,
index 45baa2fd3ec7608697e8dbfc3bdbef32edb03dc0..a4aa1d8b6c003184f24b174c6efa64e6564f9b7f 100644 (file)
@@ -512,6 +512,12 @@ efi_convert_pointer(efi_uintn_t debug_disposition, void **address)
                ret = EFI_INVALID_PARAMETER;
                goto out;
        }
+       if (!*address) {
+               if (debug_disposition & EFI_OPTIONAL_PTR)
+                       return EFI_SUCCESS;
+               else
+                       return EFI_INVALID_PARAMETER;
+       }
 
        addr = (uintptr_t)*address;
        for (i = 0; i < efi_descriptor_count; i++) {