patch-2.3.43 linux/mm/mlock.c

Next file: linux/mm/mmap.c
Previous file: linux/mm/filemap.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/mm/mlock.c linux/mm/mlock.c
@@ -142,7 +142,7 @@
 
 	if (on && !capable(CAP_IPC_LOCK))
 		return -EPERM;
-	len = (len + ~PAGE_MASK) & PAGE_MASK;
+	len = PAGE_ALIGN(len);
 	end = start + len;
 	if (end < start)
 		return -EINVAL;
@@ -191,7 +191,7 @@
 	int error = -ENOMEM;
 
 	down(&current->mm->mmap_sem);
-	len = (len + (start & ~PAGE_MASK) + ~PAGE_MASK) & PAGE_MASK;
+	len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
 	start &= PAGE_MASK;
 
 	locked = len >> PAGE_SHIFT;
@@ -220,7 +220,7 @@
 	int ret;
 
 	down(&current->mm->mmap_sem);
-	len = (len + (start & ~PAGE_MASK) + ~PAGE_MASK) & PAGE_MASK;
+	len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
 	start &= PAGE_MASK;
 	ret = do_mlock(start, len, 0);
 	up(&current->mm->mmap_sem);

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