mm/util: use offset_in_page macro
authorAlexander Kuleshov <kuleshovmail@gmail.com>
Fri, 6 Nov 2015 02:46:46 +0000 (18:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 6 Nov 2015 03:34:48 +0000 (19:34 -0800)
linux/mm.h provides offset_in_page() macro.  Let's use already predefined
macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/util.c

index 68ff8a5361e79a30233fe9ecc4b26b09e614e1b8..9af1c12b310c7f092f030fc1a4303c287724b0a6 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -309,7 +309,7 @@ unsigned long vm_mmap(struct file *file, unsigned long addr,
 {
        if (unlikely(offset + PAGE_ALIGN(len) < offset))
                return -EINVAL;
-       if (unlikely(offset & ~PAGE_MASK))
+       if (unlikely(offset_in_page(offset)))
                return -EINVAL;
 
        return vm_mmap_pgoff(file, addr, len, prot, flag, offset >> PAGE_SHIFT);