From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: KVM: fix warning in mmu.c
Date: Thu, 6 Feb 2014 19:51:07 -0800 [thread overview]
Message-ID: <20140207035107.GM9157@cbox> (raw)
In-Reply-To: <1391630305-8056-1-git-send-email-marc.zyngier@arm.com>
On Wed, Feb 05, 2014 at 07:58:25PM +0000, Marc Zyngier wrote:
> Compiling with THP enabled leads to the following warning:
>
> arch/arm/kvm/mmu.c: In function ?unmap_range?:
> arch/arm/kvm/mmu.c:177:39: warning: ?pte? 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.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/kvm/mmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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 = pte_offset_kernel(pmd, addr);
> clear_pte_entry(kvm, pte, addr);
> next = addr + PAGE_SIZE;
> + } else {
> + pte = NULL;
> }
If it's just for the compiler, how about just setting pte = NULL when
pte is declared in the top of the function as to not interrupt the flow?
-Christoffer
WARNING: multiple messages have this Message-ID (diff)
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org
Subject: Re: [PATCH] ARM: KVM: fix warning in mmu.c
Date: Thu, 6 Feb 2014 19:51:07 -0800 [thread overview]
Message-ID: <20140207035107.GM9157@cbox> (raw)
In-Reply-To: <1391630305-8056-1-git-send-email-marc.zyngier@arm.com>
On Wed, Feb 05, 2014 at 07:58:25PM +0000, Marc Zyngier wrote:
> Compiling with THP enabled leads to the following warning:
>
> arch/arm/kvm/mmu.c: In function ‘unmap_range’:
> arch/arm/kvm/mmu.c:177:39: warning: ‘pte’ 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.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/kvm/mmu.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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 = pte_offset_kernel(pmd, addr);
> clear_pte_entry(kvm, pte, addr);
> next = addr + PAGE_SIZE;
> + } else {
> + pte = NULL;
> }
If it's just for the compiler, how about just setting pte = NULL when
pte is declared in the top of the function as to not interrupt the flow?
-Christoffer
next prev parent reply other threads:[~2014-02-07 3:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-05 19:58 [PATCH] ARM: KVM: fix warning in mmu.c Marc Zyngier
2014-02-05 19:58 ` Marc Zyngier
2014-02-07 3:51 ` Christoffer Dall [this message]
2014-02-07 3:51 ` Christoffer Dall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140207035107.GM9157@cbox \
--to=christoffer.dall@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.