Skip to contentSkip to conversation

check pmd type before modifying pte

PATCH New janboe 1 participant 1 message Oct 12, 2009 Arm (32-bit)

lore
Share & tools
lore

janboe

author
#0 lore raw

PATCH 1/1 check pmd type before modifying pte

This patch could give a warning before modifing pte when pmd type is not correct.

---
 arch/arm/mm/mmu.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
arch/arm/mm/mmu.c +5 -0
index 4426ee6..ac8f27b 100644
@@ -487,6 +487,11 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
 		__pmd_populate(pmd, __pa(pte) | type->prot_l1);
 	}
 
+	if (pmd_bad(*pmd))
+		printk(KERN_WARNING "BUG: mapping for 0x%8lx at 0x%08lx "
+		       "pmd is not correct\n",
+		       __pfn_to_phys(pfn), addr);
+
 	pte = pte_offset_kernel(pmd, addr);
 	do {
 		set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0);
Signature · 1 line
1.6.3.3