linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] arm/arm64: KVM: fix two build failured under STRICT_MM_TYPECHECKS
Date: Tue, 30 Jun 2015 18:04:50 +0200	[thread overview]
Message-ID: <1435680290-13945-2-git-send-email-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <1435680290-13945-1-git-send-email-ard.biesheuvel@linaro.org>

This fixes two instances where a pgprot_t is used as the operand
of a bitwise & operation. In order to comply with STRICT_MM_TYPECHECKS,
bitwise arithmetic on a pgprot_t should go via the pgprot_val()
accessor.

Cc: kvmarm at lists.cs.columbia.edu
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/arm/kvm/mmu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 1d5accbd3dcf..a255c7dd534b 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -213,7 +213,8 @@ static void unmap_ptes(struct kvm *kvm, pmd_t *pmd,
 			kvm_tlb_flush_vmid_ipa(kvm, addr);
 
 			/* No need to invalidate the cache for device mappings */
-			if ((pte_val(old_pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
+			if ((pte_val(old_pte) & pgprot_val(PAGE_S2_DEVICE)) !=
+			    pgprot_val(PAGE_S2_DEVICE))
 				kvm_flush_dcache_pte(old_pte);
 
 			put_page(virt_to_page(pte));
@@ -306,7 +307,8 @@ static void stage2_flush_ptes(struct kvm *kvm, pmd_t *pmd,
 	pte = pte_offset_kernel(pmd, addr);
 	do {
 		if (!pte_none(*pte) &&
-		    (pte_val(*pte) & PAGE_S2_DEVICE) != PAGE_S2_DEVICE)
+		    (pte_val(*pte) & pgprot_val(PAGE_S2_DEVICE)) !=
+		    pgprot_val(PAGE_S2_DEVICE))
 			kvm_flush_dcache_pte(*pte);
 	} while (pte++, addr += PAGE_SIZE, addr != end);
 }
-- 
1.9.1

  reply	other threads:[~2015-06-30 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 16:04 [PATCH 1/2] arm64: fix incorrect use of pgprot_t variable Ard Biesheuvel
2015-06-30 16:04 ` Ard Biesheuvel [this message]
2015-06-30 17:03   ` [PATCH 2/2] arm/arm64: KVM: fix two build failured under STRICT_MM_TYPECHECKS Catalin Marinas
2015-07-01 10:56     ` Marc Zyngier
2015-06-30 17:04 ` [PATCH 1/2] arm64: fix incorrect use of pgprot_t variable Catalin Marinas

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=1435680290-13945-2-git-send-email-ard.biesheuvel@linaro.org \
    --to=ard.biesheuvel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).