Browse Source

KVM: x86: prevent uninitialized variable warning in check_svme()

get_msr() of MSR_EFER is currently always going to succeed, but static
checker doesn't see that far.

Don't complicate stuff and just use 0 for the fallback -- it means that
the feature is not present.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Radim Krčmář 8 years ago
parent
commit
92ceb7679a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      arch/x86/kvm/emulate.c

+ 1 - 1
arch/x86/kvm/emulate.c

@@ -4173,7 +4173,7 @@ static int check_dr_write(struct x86_emulate_ctxt *ctxt)
 
 
 static int check_svme(struct x86_emulate_ctxt *ctxt)
 static int check_svme(struct x86_emulate_ctxt *ctxt)
 {
 {
-	u64 efer;
+	u64 efer = 0;
 
 
 	ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
 	ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);