diff options
author | Andrew Turner <andrew@FreeBSD.org> | 2022-05-21 10:45:41 +0000 |
---|---|---|
committer | Andrew Turner <andrew@FreeBSD.org> | 2022-06-07 14:20:18 +0000 |
commit | e7219c3818d1554830555278a32934c9fb4e7ac3 (patch) | |
tree | 617d81eb4cfea0a8fb9c27971b6be9241c931426 | |
parent | c74a6c3038ea1cf381931b59f4c9a3cb2b6eae20 (diff) | |
download | src-e7219c3818d1554830555278a32934c9fb4e7ac3.tar.gz src-e7219c3818d1554830555278a32934c9fb4e7ac3.zip |
Set mm before passing it to the UEFI firmware
When reading the UEFI memory map we pass in a pointer to the memory to
hold the map. Unfortunately it wasn't initialised before the first use
so clang decided it was undefined behaviour so the entire loop was
removed. This leads to everything in bi_load after this to also be
removed as dead code.
The next function after bi_load in the binary is efi_copy_init. The
above caused us to enter efi_copy_init with a return address of the
start of the function. Because of this it would enter an infinite
loop of calling the function, allocating memory, then returning to
the start of the function.
PR: 264021
(cherry picked from commit 0d6600b579be769b85f049ef421023316f21b5c3)
-rw-r--r-- | stand/efi/loader/bootinfo.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index bf98105eee93..92ca220e2bf9 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -350,6 +350,7 @@ bi_load_efi_data(struct preloaded_file *kfp) */ sz = 0; + mm = NULL; /* * Matthew Garrett has observed at least one system changing the |