Commit a0615a16 authored by Reza Arbab's avatar Reza Arbab Committed by Michael Ellerman

powerpc/mm: Use the correct pointer when setting a 2MB pte

When setting a 2MB pte, radix__map_kernel_page() is using the address

	ptep = (pte_t *)pudp;

Fix this conversion to use pmdp instead. Use pmdp_ptep() to do this
instead of casting the pointer.

Fixes: 2bfd65e4 ("powerpc/mm/radix: Add radix callbacks for early init routines")
Cc: stable@vger.kernel.org # v4.7+
Reviewed-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarReza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b5fa0f7f
...@@ -65,7 +65,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, ...@@ -65,7 +65,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa,
if (!pmdp) if (!pmdp)
return -ENOMEM; return -ENOMEM;
if (map_page_size == PMD_SIZE) { if (map_page_size == PMD_SIZE) {
ptep = (pte_t *)pudp; ptep = pmdp_ptep(pmdp);
goto set_the_pte; goto set_the_pte;
} }
ptep = pte_alloc_kernel(pmdp, ea); ptep = pte_alloc_kernel(pmdp, ea);
...@@ -90,7 +90,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa, ...@@ -90,7 +90,7 @@ int radix__map_kernel_page(unsigned long ea, unsigned long pa,
} }
pmdp = pmd_offset(pudp, ea); pmdp = pmd_offset(pudp, ea);
if (map_page_size == PMD_SIZE) { if (map_page_size == PMD_SIZE) {
ptep = (pte_t *)pudp; ptep = pmdp_ptep(pmdp);
goto set_the_pte; goto set_the_pte;
} }
if (!pmd_present(*pmdp)) { if (!pmd_present(*pmdp)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment