From: David S. Miller Date: Fri, 31 Mar 2006 08:36:25 +0000 (-0800) Subject: [SPARC64]: Align address in huge_pte_alloc(). X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9df1dab1df58ef20ef7df9b8f39d86cf5d2d1949;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git [SPARC64]: Align address in huge_pte_alloc(). We are about to fill in all HPAGE_SIZE's worth of PAGE_SIZE ptes, so we have to give the first pte in that set else we scribble over random memory when we fill in the ptes. Signed-off-by: David S. Miller --- diff --git a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c index 074620d413d4..fbbbebbad8a4 100644 --- a/arch/sparc64/mm/hugetlbpage.c +++ b/arch/sparc64/mm/hugetlbpage.c @@ -198,6 +198,13 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) pmd_t *pmd; pte_t *pte = NULL; + /* We must align the address, because our caller will run + * set_huge_pte_at() on whatever we return, which writes out + * all of the sub-ptes for the hugepage range. So we have + * to give it the first such sub-pte. + */ + addr &= HPAGE_MASK; + pgd = pgd_offset(mm, addr); pud = pud_alloc(mm, pgd, addr); if (pud) {