From: Ross Philipson Date: Wed, 24 Aug 2022 14:47:02 +0000 (-0400) Subject: loader/i386/bsd: Initialize BSD relocator state variables X-Git-Tag: grub-2.12-rc1~269 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=170f17734a02c6c2d3d3d5b78ce59984e70c38f7;p=thirdparty%2Fgrub.git loader/i386/bsd: Initialize BSD relocator state variables 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 Reviewed-by: Daniel Kiper --- diff --git a/grub-core/loader/i386/bsd.c b/grub-core/loader/i386/bsd.c index 5838fc8f4..1f9128f6f 100644 --- a/grub-core/loader/i386/bsd.c +++ b/grub-core/loader/i386/bsd.c @@ -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;