From 6f3841eb4f9facfe6b59d2ce2ce2d26cb70491f9 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Wed, 19 Jun 2013 10:06:07 +1000 Subject: [PATCH] vmalloc-introduce-remap_vmalloc_range_partial-fix use PAGE_ALIGNED() Cc: Atsushi Kumagai Cc: HATAYAMA Daisuke Cc: KOSAKI Motohiro Cc: Lisa Mitchell Cc: Vivek Goyal Cc: Zhang Yanfei Signed-off-by: Andrew Morton --- mm/vmalloc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index d9a9f4f6ee07..b7259906a806 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1476,10 +1476,9 @@ static void __vunmap(const void *addr, int deallocate_pages) if (!addr) return; - if ((PAGE_SIZE-1) & (unsigned long)addr) { - WARN(1, KERN_ERR "Trying to vfree() bad address (%p)\n", addr); + if (WARN(!PAGE_ALIGNED(addr), "Trying to vfree() bad address (%p)\n", + addr)); return; - } area = remove_vm_area(addr); if (unlikely(!area)) { @@ -2170,8 +2169,7 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr, size = PAGE_ALIGN(size); - if (((PAGE_SIZE-1) & (unsigned long)uaddr) || - ((PAGE_SIZE-1) & (unsigned long)kaddr)) + if (!PAGE_ALIGNED(uaddr) || !PAGE_ALIGNED(kaddr)) return -EINVAL; area = find_vm_area(kaddr); -- 2.39.5