]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
loader/i386/bsd: Initialize BSD relocator state variables
authorRoss Philipson <ross.philipson@oracle.com>
Wed, 24 Aug 2022 14:47:02 +0000 (10:47 -0400)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 4 Oct 2022 12:46:56 +0000 (14:46 +0200)
Numerous register fields in the relocator state are simply not
used depending on the relocator. This causes Coverity to flag
these fields but there is no real bug here. Simply initializing
the variable to {0} solves the issue. Fixed in the else case too
for consistency.

Fixes: CID 396932
Signed-off-by: Ross Philipson <ross.philipson@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/i386/bsd.c

index 5838fc8f438627e1483c5ebcee4a61c4c50eb2c8..1f9128f6f20f1f5730c97dafcc64d44334abde02 100644 (file)
@@ -728,7 +728,7 @@ grub_freebsd_boot (void)
 
   if (is_64bit)
     {
-      struct grub_relocator64_state state;
+      struct grub_relocator64_state state = {0};
       grub_uint8_t *pagetable;
       grub_uint32_t *stack;
       grub_addr_t stack_target;
@@ -767,7 +767,7 @@ grub_freebsd_boot (void)
     }
   else
     {
-      struct grub_relocator32_state state;
+      struct grub_relocator32_state state = {0};
       grub_uint32_t *stack;
       grub_addr_t stack_target;