]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
lib: efi_loader: Fix efi_dp_from_mem() calls
authorMoritz Fischer <moritzf@google.com>
Wed, 30 Oct 2024 21:17:48 +0000 (21:17 +0000)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 31 Oct 2024 05:05:39 +0000 (06:05 +0100)
The function expects an end address but is being called with
an size instead.

Fixes: 6422820ac3 ("efi_loader: split unrelated code from efi_bootmgr.c")
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Patrick Wildt <pwildt@google.com>
lib/efi_loader/efi_bootbin.c
lib/efi_loader/efi_device_path.c

index a87006b3c0ede5d33be16790cedfb183e1126491..bf38392fac38dd71476542868bba0b3337ca5d0c 100644 (file)
@@ -137,6 +137,7 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
                 */
                file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
                                            (uintptr_t)source_buffer,
+                                           (uintptr_t)source_buffer +
                                            source_size);
                /*
                 * Make sure that device for device_path exist
index 9de3b95d073b201b60a76e9d00cfcc9f10e08dd0..d7444588aa00ee397fbad69dc0284989be7e1f3a 100644 (file)
@@ -1073,7 +1073,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
                efi_get_image_parameters(&image_addr, &image_size);
 
                dp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
-                                    (uintptr_t)image_addr, image_size);
+                                    (uintptr_t)image_addr,
+                                    (uintptr_t)image_addr + image_size);
        } else if (IS_ENABLED(CONFIG_NETDEVICES) && !strcmp(dev, "Net")) {
                dp = efi_dp_from_eth();
        } else if (!strcmp(dev, "Uart")) {