patch-2.3.26 linux/drivers/sbus/char/flash.c

Next file: linux/drivers/sbus/char/vfc_dev.c
Previous file: linux/drivers/parport/share.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.25/linux/drivers/sbus/char/flash.c linux/drivers/sbus/char/flash.c
@@ -55,12 +55,13 @@
 			return -ENXIO;
 	}
 
-	if (vma->vm_offset > size)
+	if (vma->vm_pgoff > (size >> PAGE_SHIFT))
 		return -ENXIO;
-	addr += vma->vm_offset;
+	off = vma->vm_pgoff << PAGE_SHIFT;
+	addr += off;
 
-	if (vma->vm_end - (vma->vm_start + vma->vm_offset) > size)
-		size = vma->vm_end - (vma->vm_start + vma->vm_offset);
+	if (vma->vm_end - (vma->vm_start + off) > size)
+		size = vma->vm_end - (vma->vm_start + off);
 
 	pgprot_val(vma->vm_page_prot) &= ~(_PAGE_CACHE);
 	pgprot_val(vma->vm_page_prot) |= _PAGE_E;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)