Skip to contentSkip to conversation

madvise: use PAGE_ALIGN[ED] for range checking

PATCH New Wei Yang 1 participant 1 message Nov 18, 2019

Subsystems (2)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 madvise: use PAGE_ALIGN[ED] for range checking

Improve readability, no functional change.

---
 mm/madvise.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/madvise.c +2 -2
index 2be9f3fdb05e..89913b545649 100644
@@ -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)
Signature · 1 line
2.17.1