[PATCH] kvm: fix maybe-uninitialized compiler warning

From: Clemens Gruber
Date: Fri Sep 04 2015 - 17:09:12 EST


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@xxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/