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


Groups > linux.kernel > #1219323 > unrolled thread

[PATCH] kvm: fix maybe-uninitialized compiler warning

Started byClemens Gruber <clemens.gruber@pqgruber.com>
First post2015-09-04 23:10 +0200
Last post2015-09-06 09:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] kvm: fix maybe-uninitialized compiler warning Clemens Gruber <clemens.gruber@pqgruber.com> - 2015-09-04 23:10 +0200
    Re: [PATCH] kvm: fix maybe-uninitialized compiler warning Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-09-06 09:40 +0200

#1219323 — [PATCH] kvm: fix maybe-uninitialized compiler warning

FromClemens Gruber <clemens.gruber@pqgruber.com>
Date2015-09-04 23:10 +0200
Subject[PATCH] kvm: fix maybe-uninitialized compiler warning
Message-ID<q56pc-5eU-29@gated-at.bofh.it>
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

--
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/

[toc] | [next] | [standalone]


#1219768

FromXiao Guangrong <guangrong.xiao@linux.intel.com>
Date2015-09-06 09:40 +0200
Message-ID<q5CIp-Cy-1@gated-at.bofh.it>
In reply to#1219323

On 09/05/2015 05:07 AM, Clemens Gruber wrote:
> 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;
>

Clemens, this is a know issue, please refer to:
       https://lkml.org/lkml/2015/9/1/27
--
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web