Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752451AbbHUE4I (ORCPT ); Fri, 21 Aug 2015 00:56:08 -0400 Received: from mga03.intel.com ([134.134.136.65]:7286 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751163AbbHUE4F (ORCPT ); Fri, 21 Aug 2015 00:56:05 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,719,1432623600"; d="scan'208";a="788212180" From: Xiao Guangrong To: pbonzini@redhat.com Cc: gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Xiao Guangrong Subject: [PATCH 1/9] KVM: MMU: fix use uninitialized value Date: Fri, 21 Aug 2015 12:50:03 +0800 Message-Id: <1440132611-26052-2-git-send-email-guangrong.xiao@linux.intel.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1440132611-26052-1-git-send-email-guangrong.xiao@linux.intel.com> References: <1440132611-26052-1-git-send-email-guangrong.xiao@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1215 Lines: 37 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 --- 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/