Commit 5d7800d9 authored by ZhangPeng's avatar ZhangPeng Committed by Andrew Morton

mm: kmsan: use helper function page_size()

Patch series "minor cleanups for kmsan".

Use helper function and macros to improve code readability.  No functional
modification involved.


This patch (of 3):

Use function page_size() to improve code readability.  No functional
modification involved.

Link: https://lkml.kernel.org/r/20230727011612.2721843-1-zhangpeng362@huawei.com
Link: https://lkml.kernel.org/r/20230727011612.2721843-2-zhangpeng362@huawei.comSigned-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
Reviewed-by: default avatarAlexander Potapenko <glider@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Marco Elver <elver@google.com>
Cc: Nanyong Sun <sunnanyong@huawei.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 6e412203
...@@ -117,7 +117,7 @@ void kmsan_kfree_large(const void *ptr) ...@@ -117,7 +117,7 @@ void kmsan_kfree_large(const void *ptr)
page = virt_to_head_page((void *)ptr); page = virt_to_head_page((void *)ptr);
KMSAN_WARN_ON(ptr != page_address(page)); KMSAN_WARN_ON(ptr != page_address(page));
kmsan_internal_poison_memory((void *)ptr, kmsan_internal_poison_memory((void *)ptr,
PAGE_SIZE << compound_order(page), page_size(page),
GFP_KERNEL, GFP_KERNEL,
KMSAN_POISON_CHECK | KMSAN_POISON_FREE); KMSAN_POISON_CHECK | KMSAN_POISON_FREE);
kmsan_leave_runtime(); kmsan_leave_runtime();
......
...@@ -210,7 +210,7 @@ void kmsan_free_page(struct page *page, unsigned int order) ...@@ -210,7 +210,7 @@ void kmsan_free_page(struct page *page, unsigned int order)
return; return;
kmsan_enter_runtime(); kmsan_enter_runtime();
kmsan_internal_poison_memory(page_address(page), kmsan_internal_poison_memory(page_address(page),
PAGE_SIZE << compound_order(page), page_size(page),
GFP_KERNEL, GFP_KERNEL,
KMSAN_POISON_CHECK | KMSAN_POISON_FREE); KMSAN_POISON_CHECK | KMSAN_POISON_FREE);
kmsan_leave_runtime(); kmsan_leave_runtime();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment