Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210859

[PATCH 1/9] KVM: MMU: fix use uninitialized value

From Xiao Guangrong <guangrong.xiao@linux.intel.com>
Newsgroups linux.kernel
Subject [PATCH 1/9] KVM: MMU: fix use uninitialized value
Date 2015-08-21 07:00 +0200
Message-ID <pZMAQ-1LC-23@gated-at.bofh.it> (permalink)
References <pZMAO-1LC-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


GCC (gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)) complains
of this warning:

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;

It's true as shadow_walk_init() may stop the loop

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.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 70c375f..a8a5b8d 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 = PT64_ROOT_LEVEL;
 	bool reserved = false;
 
 	if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
-- 
2.4.3

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] KVM: x86: enable cflushopt/clwb/pcommit and simplify code Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 9/9] KVM: VMX: drop rdtscp_enabled field Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 8/9] KVM: VMX: introduce set_clear_2nd_exec_ctrl() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 3/9] KVM: x86: add pcommit support Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 1/9] KVM: MMU: fix use uninitialized value Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 7/9] KVM: VMX: unify SECONDARY_VM_EXEC_CONTROL update Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 4/9] KVM: VMX: drop rdtscp_enabled check in prepare_vmcs02() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200
  [PATCH 5/9] KVM: VMX: simplify rdtscp handling in vmx_cpuid_update() Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-21 07:00 +0200

csiph-web