public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: x86: kvm: x86.c:  Cleaning up uninitialized variables
@ 2014-05-31 23:05 Rickard Strandqvist
  2014-06-03 12:04 ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Rickard Strandqvist @ 2014-05-31 23:05 UTC (permalink / raw)
  To: Gleb Natapov, Paolo Bonzini
  Cc: Rickard Strandqvist, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	x86, kvm, linux-kernel

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 arch/x86/kvm/x86.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 20316c6..88bf642 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5691,13 +5691,17 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu)
 		outgpa = ((u64)kvm_register_read(vcpu, VCPU_REGS_RDI) << 32) |
 			(kvm_register_read(vcpu, VCPU_REGS_RSI) & 0xffffffff);
 	}
-#ifdef CONFIG_X86_64
 	else {
+#ifdef CONFIG_X86_64
 		param = kvm_register_read(vcpu, VCPU_REGS_RCX);
 		ingpa = kvm_register_read(vcpu, VCPU_REGS_RDX);
 		outgpa = kvm_register_read(vcpu, VCPU_REGS_R8);
-	}
+#else
+		param = 0;
+		ingpa = 0;
+		outgpa = 0;
 #endif
+	}
 
 	code = param & 0xffff;
 	fast = (param >> 16) & 0x1;
-- 
1.7.10.4


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

end of thread, other threads:[~2014-06-03 13:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-31 23:05 [PATCH] arch: x86: kvm: x86.c: Cleaning up uninitialized variables Rickard Strandqvist
2014-06-03 12:04 ` Paolo Bonzini
2014-06-03 13:06   ` Michael Tokarev
2014-06-03 13:11     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox