[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 4/7] grub-core/loader/i386/xnu.c: Fix uninitialized scalar var

From: Alec Brown
Subject: [PATCH v2 4/7] grub-core/loader/i386/xnu.c: Fix uninitialized scalar variable
Date: Mon, 21 Mar 2022 02:28:59 -0400

In the function grub_xnu_boot_resume(), struct grub_relocator32_state state is
called but isn't being initialized. This results in the members grub_uint32_t
ebx, grub_uint32_t ecx, grub_uint32_t edx, grub_uint32_t esi, and grub_uint32_t
edi being filled with junk data from the stack since none of them are being set
to any values. We can prevent this by setting state to {0}.

Fixes: CID 375031

Signed-off-by: Alec Brown <>
 grub-core/loader/i386/xnu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
index a70093607..2bc118fc0 100644
--- a/grub-core/loader/i386/xnu.c
+++ b/grub-core/loader/i386/xnu.c
@@ -805,7 +805,7 @@ grub_cpu_xnu_fill_devicetree (grub_uint64_t *fsbfreq_out)
 grub_xnu_boot_resume (void)
-  struct grub_relocator32_state state;
+  struct grub_relocator32_state state = {0};
   state.esp = grub_xnu_stack;
   state.ebp = grub_xnu_stack;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]