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

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


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 19 Apr 2021 15:01:27 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 19 Apr 2021 14:01:51 +0000
  • Ironport-hdrordr: A9a23:HRN7aaCJLywv6UHlHekp55DYdL4zR+YMi2QD/WoZc3JoW+afkN 2jm+le6AT9jywfVGpltdeLPqSBRn20z+8N3aA6O7C+UA76/Fa5NY0K1/qF/xTMEzDzn9Q86Y 5OaK57YeedMXFbioLA7BC8A5IcxrC8gcWVrMP/61socg1wcaFn6G5Ce2GmO2l7XhNPC5Z8NL f03LslmxOadX4abtu2CxA+NoCpzbD2vanrbhIcCxks5BPmt0LN1JfAHwWFxRBbajtTwN4ZgB D4ujbk7aauuezT8H7h/lLUhq44pPLRjv9KBMmBkaEuW1fRtjo=
  • Ironport-sdr: 9dLxGOaIsnB66Fuzg95ph/S9+suSyg6IWMg+z9hhurXGdoZA5tb3pUkQGGadGtQyIqHDplGWwY aJ1/XU0bwious1VjmOyp+YBy6PF+VAIbBtt0OtKuCAGqcH/br8zyTuqIReMFLee4fTHtjBwCSP 4OWoy7wOC8ksgqyluh4Hjh2LKdtXFEux4H1aMrA59k4hkJlp6LTJWby5wv2SMD8RFujrULqmpQ BzNP/37eL4OdmULPuRYn/BR3Hq5iYK4MBslA8oGjtOOZL5LVZ67heT6c60m2h5ygNTlFds2KQB X/E=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.