:: commit 0cb95d7e478a37345730a8a2a55c22b3e0c8081a

mintsuki <mintsuki@protonmail.com> — 2022-09-18 08:39

parents: 143d00120e

efi: Limit amount of tries to get boot volume from handle

diff --git a/common/entry.s3.c b/common/entry.s3.c
index 44ca8c1b..49061b76 100644
--- a/common/entry.s3.c
+++ b/common/entry.s3.c
@@ -58,8 +58,9 @@ noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
     boot_volume = NULL;
 
     EFI_HANDLE current_handle = ImageHandle;
-    for (;;) {
+    for (size_t j = 0; j < 25; j++) {
         if (current_handle == NULL) {
+could_not_match:
             print("WARNING: Could not meaningfully match the boot device handle with a volume.\n");
             print("         Using the first volume containing a Limine configuration!\n");
 
@@ -112,6 +113,8 @@ noreturn void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
 
         current_handle = loaded_image->ParentHandle;
     }
+
+    goto could_not_match;
 }
 #endif
 
tab: 248 wrap: offon