powerpc/mm/hugetlb: Use pte_access_permitted for hugetlb access check
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Mon, 4 Dec 2017 02:19:10 +0000 (07:49 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 22 Dec 2017 11:28:31 +0000 (22:28 +1100)
No functional change in this patch. This update gup_hugepte to use the
helper. This will help later when we add memory keys.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/hugetlbpage.c

index a9b9083c5e4999bc398442ef3f8945040b47fac6..c7e5afe5e118e4a15b7e13cdf29bf999ba73c4b0 100644 (file)
@@ -855,9 +855,7 @@ int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
 
        pte = READ_ONCE(*ptep);
 
-       if (!pte_present(pte) || !pte_read(pte))
-               return 0;
-       if (write && !pte_write(pte))
+       if (!pte_access_permitted(pte, write))
                return 0;
 
        /* hugepages are never "special" */