diff mbox series

efi_loader: access __efi_runtime_rel_start/stop without &

Message ID 20240404063738.470494-1-ilias.apalodimas@linaro.org
State Accepted
Commit 3f8d13044b32ddd906bb9f2fc705b988ec93df35
Headers show
Series efi_loader: access __efi_runtime_rel_start/stop without & | expand

Commit Message

Ilias Apalodimas April 4, 2024, 6:37 a.m. UTC
A symbol defined in a linker script (e.g. __efi_runtime_rel_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_rel_start or
extern char __efi_runtime_rel_start[] and access it as
&__efi_runtime_rel_start or __efi_runtime_rel_start respectively.

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

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
 lib/efi_loader/efi_runtime.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index 9185f1894c47..fdf2fbd9ba3d 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -669,14 +669,14 @@  static __efi_runtime void efi_relocate_runtime_table(ulong offset)
 void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map)
 {
 #ifdef IS_RELA
-	struct elf_rela *rel = (void*)&__efi_runtime_rel_start;
+	struct elf_rela *rel = (void *)__efi_runtime_rel_start;
 #else
-	struct elf_rel *rel = (void*)&__efi_runtime_rel_start;
+	struct elf_rel *rel = (void *)__efi_runtime_rel_start;
 	static ulong lastoff = CONFIG_TEXT_BASE;
 #endif
 
 	debug("%s: Relocating to offset=%lx\n", __func__, offset);
-	for (; (ulong)rel < (ulong)&__efi_runtime_rel_stop; rel++) {
+	for (; (ulong)rel < (ulong)__efi_runtime_rel_stop; rel++) {
 		ulong base = CONFIG_TEXT_BASE;
 		ulong *p;
 		ulong newaddr;