From: Andrew Morton Date: Wed, 19 Jun 2013 00:06:07 +0000 (+1000) Subject: vmalloc-introduce-remap_vmalloc_range_partial-fix X-Git-Tag: next-20130619~2^2~510 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6f3841eb4f9facfe6b59d2ce2ce2d26cb70491f9;p=karo-tx-linux.git 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 --- 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);