[PATCH 03/10] mm/mincore: Use offset_in_page macro

From: Alexander Kuleshov
Date: Tue Sep 15 2015 - 10:08:43 EST


The <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@xxxxxxxxx>
---
mm/mincore.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mincore.c b/mm/mincore.c
index be25efd..a011355 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -234,8 +234,7 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,

/* This also avoids any overflows on PAGE_CACHE_ALIGN */
pages = len >> PAGE_SHIFT;
- pages += (len & ~PAGE_MASK) != 0;
+ pages += (offset_in_page(len)) != 0;

if (!access_ok(VERIFY_WRITE, vec, pages))
return -EFAULT;
--
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/