diff --git a/mm/memory.c b/mm/memory.c
index 70403266ba8a2a2a00edca5d66401f464e969ae2..0d58cbc7ca21925b9a3f353da191abb6e038de25 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4025,7 +4025,7 @@ int generic_access_phys(struct vm_area_struct *vma, unsigned long addr,
 	if (follow_phys(vma, addr, write, &prot, &phys_addr))
 		return -EINVAL;
 
-	maddr = ioremap_prot(phys_addr, PAGE_SIZE, prot);
+	maddr = ioremap_prot(phys_addr, PAGE_ALIGN(len + offset), prot);
 	if (write)
 		memcpy_toio(maddr + offset, buf, len);
 	else