Mailing List Archive

[PATCH 2/7] x86/shim: Fix compilation at -Og
When compiling at -Og:

shim.c: In function ‘write_start_info’:
shim.c:288:22: error: ‘param’ may be used uninitialized in this function[-Werror=maybe-uninitialized]
si->store_evtchn = param;
~~~~~~~~~~~~~~~~~^~~~~~~

and a slew of knock-on failures. All are caused by
xen_hypercall_hvm_get_param(), and presumably insufficient analysis to observe
that *value is always written on the ret=0 path.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
xen/arch/x86/pv/shim.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/pv/shim.c b/xen/arch/x86/pv/shim.c
index d16c0048c0..a05aaa7bcc 100644
--- a/xen/arch/x86/pv/shim.c
+++ b/xen/arch/x86/pv/shim.c
@@ -282,7 +282,7 @@ static void write_start_info(struct domain *d)
struct cpu_user_regs *regs = guest_cpu_user_regs();
start_info_t *si = map_domain_page(_mfn(is_pv_32bit_domain(d) ? regs->edx
: regs->rdx));
- uint64_t param;
+ uint64_t param = 0;

snprintf(si->magic, sizeof(si->magic), "xen-3.0-x86_%s",
is_pv_32bit_domain(d) ? "32p" : "64");
@@ -311,8 +311,8 @@ int pv_shim_shutdown(uint8_t reason)
struct domain *d = current->domain;
struct vcpu *v;
unsigned int i;
- uint64_t old_store_pfn, old_console_pfn = 0, store_pfn, console_pfn;
- uint64_t store_evtchn, console_evtchn;
+ uint64_t old_store_pfn = 0, old_console_pfn = 0, store_pfn = 0, console_pfn = 0;
+ uint64_t store_evtchn = 0, console_evtchn = 0;
long rc;

if ( reason != SHUTDOWN_suspend )
--
2.11.0