Skip to contentSkip to conversation

cramfs: Fix incorrect physical page address calculation

PATCH Applied Alistair Popple 3 participants 3 messages Sep 23, 2025

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

PATCH 1/1 cramfs: Fix incorrect physical page address calculation

Commit 21aa65bf82a7 ("mm: remove callers of pfn_t functionality") incorrectly replaced the pfn with the physical address when calling vmf_insert_mixed(). Instead the phys_to_pfn_t() call should have been replaced with PHYS_PFN().

Found by inspection after a similar issue was noted in fuse virtio_fs.

Fixes 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
Cc Haiyue Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Nicolas Pitre <[email protected]>
---
 fs/cramfs/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cramfs/inode.c +1 -1
index b002e9b734f9..56c8005b24a3 100644
@@ -412,7 +412,7 @@ static int cramfs_physmem_mmap(struct file *file, struct vm_area_struct *vma)
 			vm_fault_t vmf;
 			unsigned long off = i * PAGE_SIZE;
 			vmf = vmf_insert_mixed(vma, vma->vm_start + off,
-					address + off);
+					PHYS_PFN(address + off));
 			if (vmf & VM_FAULT_ERROR)
 				ret = vm_fault_to_errno(vmf, 0);
 		}
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Alistair Popple

Commit 21aa65bf82a7 ("mm: remove callers of pfn_t functionality") incorrectly replaced the pfn with the physical address when calling vmf_insert_mixed(). Instead the phys_to_pfn_t() call should have been replaced with PHYS_PFN().

Found by inspection after a similar issue was noted in fuse virtio_fs.

Quoted 9 lines
Fixes 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
Cc Haiyue Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Nicolas Pitre <[email protected]>

---

Reviewed-by on v1 1/1
#2 lore raw
In reply to Alistair Popple
Quoted 7 lines · Alistair Popple

Commit 21aa65bf82a7 ("mm: remove callers of pfn_t functionality") incorrectly replaced the pfn with the physical address when calling vmf_insert_mixed(). Instead the phys_to_pfn_t() call should have been replaced with PHYS_PFN().

Found by inspection after a similar issue was noted in fuse virtio_fs.

Quoted 7 lines
Fixes 21aa65bf82a7 ("mm: remove callers of pfn_t functionality")
Cc Haiyue Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc Nicolas Pitre <[email protected]>

---

Hopefully that's all now -- scanned the original patch and all phys_to_pfn_t now seem to have a matching PHYS_PFN.

Signature · 3 lines
Cheers

David / dhildenb