xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] VMX: fix vmx_{find,del}_msr() build
@ 2018-07-16 16:46 Jan Beulich
  2018-07-16 16:56 ` Andrew Cooper
  2018-07-18  9:36 ` Wei Liu
  0 siblings, 2 replies; 10+ messages in thread
From: Jan Beulich @ 2018-07-16 16:46 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Kevin Tian, Jun Nakajima

For a reason that I can't explain, it is only the shim build that fails
for me with an older gcc due to the compiler not recognizing that
apparently uninitialized variables aren't really uninitialized. Pull out
the assignments used by two of the three case blocks and make them
initializers of the variables, as I think I had suggested during review.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1305,7 +1305,8 @@ struct vmx_msr_entry *vmx_find_msr(const
 {
     const struct arch_vmx_struct *vmx = &v->arch.hvm_vmx;
     struct vmx_msr_entry *start = NULL, *ent, *end;
-    unsigned int substart, subend, total;
+    unsigned int substart = 0, subend = vmx->msr_save_count;
+    unsigned int total = vmx->msr_load_count;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
@@ -1313,23 +1314,18 @@ struct vmx_msr_entry *vmx_find_msr(const
     {
     case VMX_MSR_HOST:
         start    = vmx->host_msr_area;
-        substart = 0;
         subend   = vmx->host_msr_count;
         total    = subend;
         break;
 
     case VMX_MSR_GUEST:
         start    = vmx->msr_area;
-        substart = 0;
-        subend   = vmx->msr_save_count;
-        total    = vmx->msr_load_count;
         break;
 
     case VMX_MSR_GUEST_LOADONLY:
         start    = vmx->msr_area;
-        substart = vmx->msr_save_count;
-        subend   = vmx->msr_load_count;
-        total    = subend;
+        substart = subend;
+        subend   = total;
         break;
 
     default:
@@ -1461,7 +1457,8 @@ int vmx_del_msr(struct vcpu *v, uint32_t
 {
     struct arch_vmx_struct *vmx = &v->arch.hvm_vmx;
     struct vmx_msr_entry *start = NULL, *ent, *end;
-    unsigned int substart, subend, total;
+    unsigned int substart = 0, subend = vmx->msr_save_count;
+    unsigned int total = vmx->msr_load_count;
 
     ASSERT(v == current || !vcpu_runnable(v));
 
@@ -1469,23 +1466,18 @@ int vmx_del_msr(struct vcpu *v, uint32_t
     {
     case VMX_MSR_HOST:
         start    = vmx->host_msr_area;
-        substart = 0;
         subend   = vmx->host_msr_count;
         total    = subend;
         break;
 
     case VMX_MSR_GUEST:
         start    = vmx->msr_area;
-        substart = 0;
-        subend   = vmx->msr_save_count;
-        total    = vmx->msr_load_count;
         break;
 
     case VMX_MSR_GUEST_LOADONLY:
         start    = vmx->msr_area;
-        substart = vmx->msr_save_count;
-        subend   = vmx->msr_load_count;
-        total    = subend;
+        substart = subend;
+        subend   = total;
         break;
 
     default:





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-07-25  8:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-16 16:46 [PATCH] VMX: fix vmx_{find,del}_msr() build Jan Beulich
2018-07-16 16:56 ` Andrew Cooper
2018-07-17  6:57   ` Jan Beulich
2018-07-17  8:39     ` Andrew Cooper
2018-07-25  8:30       ` Wei Liu
2018-07-18  9:15   ` Jan Beulich
2018-07-18  9:36 ` Wei Liu
2018-07-18  9:39   ` Jan Beulich
2018-07-18  9:40     ` Wei Liu
2018-07-19  1:43     ` Tian, Kevin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).