From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: [PATCH] ARM: KVM: fix warning in mmu.c Date: Thu, 6 Feb 2014 19:51:07 -0800 Message-ID: <20140207035107.GM9157@cbox> References: <1391630305-8056-1-git-send-email-marc.zyngier@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org To: Marc Zyngier Return-path: Received: from mail-pa0-f48.google.com ([209.85.220.48]:49394 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbaBGDu6 (ORCPT ); Thu, 6 Feb 2014 22:50:58 -0500 Received: by mail-pa0-f48.google.com with SMTP id kx10so2623968pab.7 for ; Thu, 06 Feb 2014 19:50:57 -0800 (PST) Content-Disposition: inline In-Reply-To: <1391630305-8056-1-git-send-email-marc.zyngier@arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Feb 05, 2014 at 07:58:25PM +0000, Marc Zyngier wrote: > Compiling with THP enabled leads to the following warning: >=20 > arch/arm/kvm/mmu.c: In function =E2=80=98unmap_range=E2=80=99: > arch/arm/kvm/mmu.c:177:39: warning: =E2=80=98pte=E2=80=99 may be used= uninitialized in this function [-Wmaybe-uninitialized] > if (kvm_pmd_huge(*pmd) || page_empty(pte)) { > ^ > Code inspection reveals that these two cases are mutually exclusive, > so GCC is a bit overzealous here. But silence it anyway by setting > pte to NULL if kvm_pmd_huge(*pmd) is true. >=20 > Signed-off-by: Marc Zyngier > --- > arch/arm/kvm/mmu.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c > index ea21b6a..3020221 100644 > --- a/arch/arm/kvm/mmu.c > +++ b/arch/arm/kvm/mmu.c > @@ -169,12 +169,14 @@ static void unmap_range(struct kvm *kvm, pgd_t = *pgdp, > pte =3D pte_offset_kernel(pmd, addr); > clear_pte_entry(kvm, pte, addr); > next =3D addr + PAGE_SIZE; > + } else { > + pte =3D NULL; > } If it's just for the compiler, how about just setting pte =3D NULL when pte is declared in the top of the function as to not interrupt the flow= ? -Christoffer