s390/mm: properly clear _PAGE_NOEXEC bit when it is not supported
[sfrench/cifs-2.6.git] / arch / s390 / include / asm / pgtable.h
index cf19c006081657c457f15f310b679057ea80f05b..7b03037a8475e1aac9388c3076e06bfe6d2272ae 100644 (file)
@@ -1161,8 +1161,6 @@ void gmap_pmdp_idte_global(struct mm_struct *mm, unsigned long vmaddr);
 static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
                              pte_t *ptep, pte_t entry)
 {
-       if (!MACHINE_HAS_NX)
-               pte_val(entry) &= ~_PAGE_NOEXEC;
        if (pte_present(entry))
                pte_val(entry) &= ~_PAGE_UNUSED;
        if (mm_has_pgste(mm))
@@ -1179,6 +1177,8 @@ static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
 {
        pte_t __pte;
        pte_val(__pte) = physpage + pgprot_val(pgprot);
+       if (!MACHINE_HAS_NX)
+               pte_val(__pte) &= ~_PAGE_NOEXEC;
        return pte_mkyoung(__pte);
 }