[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <7a8f9ef7-03f7-08e3-61b2-548aa54328e3@redhat.com>
Date: Tue, 22 Jun 2021 18:43:17 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Colin King <colin.king@...onical.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H . Peter Anvin" <hpa@...or.com>,
Ben Gardon <bgardon@...gle.com>, kvm@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] KVM: x86/mmu: Fix uninitialized boolean variable
flush
On 22/06/21 17:09, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> In the case where kvm_memslots_have_rmaps(kvm) is false the boolean
> variable flush is not set and is uninitialized. If is_tdp_mmu_enabled(kvm)
> is true then the call to kvm_tdp_mmu_zap_collapsible_sptes passes the
> uninitialized value of flush into the call. Fix this by initializing
> flush to false.
>
> Addresses-Coverity: ("Uninitialized scalar variable")
> Fixes: e2209710ccc5 ("KVM: x86/mmu: Skip rmap operations if rmaps not allocated")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index ed24e97c1549..b8d20f139729 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -5689,7 +5689,7 @@ void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
> {
> /* FIXME: const-ify all uses of struct kvm_memory_slot. */
> struct kvm_memory_slot *slot = (struct kvm_memory_slot *)memslot;
> - bool flush;
> + bool flush = false;
>
> if (kvm_memslots_have_rmaps(kvm)) {
> write_lock(&kvm->mmu_lock);
>
Queued, thanks.
Paolo
Powered by blists - more mailing lists