Skip to contentSkip to conversation

mm: remove "prot" parameter from move_pte()

PATCH Applied David Hildenbrand 2 participants 2 messages Mar 27, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: remove "prot" parameter from move_pte()

The "prot" parameter is unused, and using it instead of what's stored in that particular PTE would very likely be wrong. Let's simply remove it.

Cc Andrew Morton <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Andreas Larsson <[email protected]>
---
 arch/sparc/include/asm/pgtable_64.h | 2 +-
 include/linux/pgtable.h             | 2 +-
 mm/mremap.c                         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/sparc/include/asm/pgtable_64.h +1 -1
index 4d1bafaba942..38c3446e2c61 100644
@@ -956,7 +956,7 @@ static inline void set_ptes(struct mm_struct *mm, unsigned long addr,
 
 #ifdef DCACHE_ALIASING_POSSIBLE
 #define __HAVE_ARCH_MOVE_PTE
-#define move_pte(pte, prot, old_addr, new_addr)				\
+#define move_pte(pte, old_addr, new_addr)				\
 ({									\
 	pte_t newpte = (pte);						\
 	if (tlb_type != hypervisor && pte_present(pte)) {		\
include/linux/pgtable.h +1 -1
index 09c85c7bf9c2..e62fe05318db 100644
@@ -1079,7 +1079,7 @@ static inline void arch_swap_restore(swp_entry_t entry, struct folio *folio)
 #endif
 
 #ifndef __HAVE_ARCH_MOVE_PTE
-#define move_pte(pte, prot, old_addr, new_addr)	(pte)
+#define move_pte(pte, old_addr, new_addr)	(pte)
 #endif
 
 #ifndef pte_accessible
mm/mremap.c +1 -1
index 38d98465f3d8..f5aba752d35f 100644
@@ -205,7 +205,7 @@ static int move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
 		 */
 		if (pte_present(pte))
 			force_flush = true;
-		pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr);
+		pte = move_pte(pte, old_addr, new_addr);
 		pte = move_soft_dirty_pte(pte);
 		set_pte_at(mm, new_addr, new_pte, pte);
 	}
Signature · 1 line
2.43.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · David Hildenbrand

The "prot" parameter is unused, and using it instead of what's stored in that particular PTE would very likely be wrong. Let's simply remove it.

Cc Andrew Morton <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Andreas Larsson <[email protected]>

Its interesting looking at how long this has been unused for.