]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
vmalloc-introduce-remap_vmalloc_range_partial-fix
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 19 Jun 2013 00:06:07 +0000 (10:06 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 19 Jun 2013 07:13:05 +0000 (17:13 +1000)
use PAGE_ALIGNED()

Cc: Atsushi Kumagai <kumagai-atsushi@mxc.nes.nec.co.jp>
Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Lisa Mitchell <lisa.mitchell@hp.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmalloc.c

index d9a9f4f6ee0767684752a1062a3ee8e20d1917bc..b7259906a806ddf6276d1c4b164f1ce11c944a1b 100644 (file)
@@ -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);