kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: fix maybe-uninitialized compiler warning
@ 2015-09-04 21:07 Clemens Gruber
  2015-09-06  7:30 ` Xiao Guangrong
  0 siblings, 1 reply; 2+ messages in thread
From: Clemens Gruber @ 2015-09-04 21:07 UTC (permalink / raw)
  To: kvm; +Cc: x86, linux-kernel, Clemens Gruber

Fixes the following compiler warning, occuring with GCC 5.2.0:

arch/x86/kvm/mmu.c: In function ‘handle_mmio_page_fault_common’:
arch/x86/kvm/mmu.c:3332:9: warning: ‘leaf’ may be used uninitialized in
this
function [-Wmaybe-uninitialized]
   while (root >= leaf) {
         ^
arch/x86/kvm/mmu.c:3304:12: note: ‘leaf’ was declared here
  int root, leaf;

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---
 arch/x86/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index fb16a8e..0af5a39 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3301,7 +3301,7 @@ walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr, u64 *sptep)
 {
 	struct kvm_shadow_walk_iterator iterator;
 	u64 sptes[PT64_ROOT_LEVEL], spte = 0ull;
-	int root, leaf;
+	int root, leaf=0;
 	bool reserved = false;
 
 	if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
-- 
2.5.1

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

end of thread, other threads:[~2015-09-06  7:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 21:07 [PATCH] kvm: fix maybe-uninitialized compiler warning Clemens Gruber
2015-09-06  7:30 ` Xiao Guangrong

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).