mm/madvise.c: use PAGE_ALIGN[ED] for range checking
authorWei Yang <richardw.yang@linux.intel.com>
Sun, 1 Dec 2019 01:57:46 +0000 (17:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 1 Dec 2019 20:59:09 +0000 (12:59 -0800)
Improve readability, no functional change.

Link: http://lkml.kernel.org/r/20191118032857.22683-1-richardw.yang@linux.intel.com
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/madvise.c

index e808dbeb27f39bbd9cce68f678c531ac334788fa..bcdb6a04278794ca97eea24cb59e8b7f04ab7111 100644 (file)
@@ -1059,9 +1059,9 @@ SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)
        if (!madvise_behavior_valid(behavior))
                return error;
 
-       if (start & ~PAGE_MASK)
+       if (!PAGE_ALIGNED(start))
                return error;
-       len = (len_in + ~PAGE_MASK) & PAGE_MASK;
+       len = PAGE_ALIGN(len_in);
 
        /* Check to see whether len was rounded up from small -ve to zero */
        if (len_in && !len)