linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] madvise: use PAGE_ALIGN[ED] for range checking
@ 2019-11-18  3:28 Wei Yang
  0 siblings, 0 replies; only message in thread
From: Wei Yang @ 2019-11-18  3:28 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Wei Yang

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(-)

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)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-18  3:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18  3:28 [PATCH] madvise: use PAGE_ALIGN[ED] for range checking Wei Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).