]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: access __efi_runtime_start/stop without &
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 4 Apr 2024 06:35:35 +0000 (09:35 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 8 Apr 2024 11:05:42 +0000 (13:05 +0200)
A symbol defined in a linker script (e.g. __efi_runtime_start = .;) is
only a symbol, not a variable and should not be dereferenced.
The common practice is either define it as
extern uint32_t __efi_runtime_start or
extern char __efi_runtime_start[] and access it as
&__efi_runtime_start or __efi_runtime_start respectively.

So let's access it properly since we define it as an array

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
lib/efi_loader/efi_memory.c

index edfad2d95a1d986b7e7215a331f48dfdf61d9528..aba3100c76855f4983faeb1ae7c0d0d9aebd851b 100644 (file)
@@ -933,8 +933,8 @@ static void add_u_boot_and_runtime(void)
         * Add Runtime Services. We mark surrounding boottime code as runtime as
         * well to fulfill the runtime alignment constraints but avoid padding.
         */
-       runtime_start = (ulong)&__efi_runtime_start & ~runtime_mask;
-       runtime_end = (ulong)&__efi_runtime_stop;
+       runtime_start = (uintptr_t)__efi_runtime_start & ~runtime_mask;
+       runtime_end = (uintptr_t)__efi_runtime_stop;
        runtime_end = (runtime_end + runtime_mask) & ~runtime_mask;
        runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT;
        efi_add_memory_map_pg(runtime_start, runtime_pages,