mm: kfence: use PAGE_ALIGNED helper

Use PAGE_ALIGNED macro instead of IS_ALIGNED and passing PAGE_SIZE.

Link: https://lkml.kernel.org/r/20220520021833.121405-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Acked-by: Muchun Song <songmuchun@bytedance.com>
Cc: Marco Elver <elver@google.com>
Cc: Alexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Kefeng Wang 2022-05-20 10:18:33 +08:00 committed by akpm
parent 0598739900
commit f403f22f8c

View File

@ -296,10 +296,9 @@ static void *test_alloc(struct kunit *test, size_t size, gfp_t gfp, enum allocat
if (policy == ALLOCATE_ANY) if (policy == ALLOCATE_ANY)
return alloc; return alloc;
if (policy == ALLOCATE_LEFT && IS_ALIGNED((unsigned long)alloc, PAGE_SIZE)) if (policy == ALLOCATE_LEFT && PAGE_ALIGNED(alloc))
return alloc; return alloc;
if (policy == ALLOCATE_RIGHT && if (policy == ALLOCATE_RIGHT && !PAGE_ALIGNED(alloc))
!IS_ALIGNED((unsigned long)alloc, PAGE_SIZE))
return alloc; return alloc;
} else if (policy == ALLOCATE_NONE) } else if (policy == ALLOCATE_NONE)
return alloc; return alloc;