madvise: use PAGE_ALIGN[ED] for range checking
diff mbox series

Message ID 20191118032857.22683-1-richardw.yang@linux.intel.com
State New
Headers show
Series
  • madvise: use PAGE_ALIGN[ED] for range checking
Related show

Commit Message

Wei Yang Nov. 18, 2019, 3:28 a.m. UTC
Improve readability, no functional change.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
---
 mm/madvise.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/mm/madvise.c b/mm/madvise.c
index 2be9f3fdb05e..89913b545649 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -1051,9 +1051,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)