ARM: mm: Allow an empty PMD in alloc_init_pte()

The Android patch titled "ARM: allow the kernel text section to
be made read-only" modifies alloc_init_pte() and adds a BUG_ON
to detect the case where a section mapping is being overwritten.
However the test doesn't allow for the legitimate case where the
PMD is empty, as can happen for kernels built with CONFIG_ARM_LPAE.
So extend the test to allow this.

Change-Id: I28eeaefd856bae63a5532980e41e0fd4d8922e79
Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
This commit is contained in:
Jon Medhurst (Tixy) 2012-11-28 11:17:51 +00:00 committed by Arve Hjønnevåg
parent 22eee1aaff
commit 7a8ab31b78
1 changed files with 1 additions and 1 deletions

View File

@ -627,7 +627,7 @@ static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
pte_t *pte = start_pte + pte_index(addr);
/* If replacing a section mapping, the whole section must be replaced */
BUG_ON(pmd_bad(*pmd) && ((addr | end) & ~PMD_MASK));
BUG_ON(!pmd_none(*pmd) && pmd_bad(*pmd) && ((addr | end) & ~PMD_MASK));
do {
set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0);