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

[Xen-changelog] [xen stable-4.10] VMX: fix vmx_{find, del}_msr() build



commit 0de39f36b73a6068b9bd13f5ccd1adec03c09052
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jul 19 11:54:45 2018 +0200
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Aug 14 17:16:28 2018 +0100

    VMX: fix vmx_{find,del}_msr() build
    
    Older gcc at -O2 (and perhaps higher) does not recognize 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@xxxxxxxx>
    Reviewed-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx>
    (cherry picked from commit 97cb0516a322ecdf0032fa9d8aa1525c03d7772f)
---
 xen/arch/x86/hvm/vmx/vmcs.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 9fdcee8cb8..6a4f342a7d 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1313,7 +1313,8 @@ struct vmx_msr_entry *vmx_find_msr(const struct vcpu *v, 
uint32_t msr,
 {
     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));
 
@@ -1321,23 +1322,18 @@ struct vmx_msr_entry *vmx_find_msr(const struct vcpu 
*v, uint32_t msr,
     {
     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:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.10

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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