mm: kmsan: use helper macro offset_in_page()
Use helper macro offset_in_page() to improve code readability. No functional modification involved. Link: https://lkml.kernel.org/r/20230727011612.2721843-3-zhangpeng362@huawei.com Signed-off-by: ZhangPeng <zhangpeng362@huawei.com> Reviewed-by: Alexander 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: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
5d7800d9cb
commit
4852a80524
|
@ -339,7 +339,7 @@ void kmsan_handle_dma(struct page *page, size_t offset, size_t size,
|
|||
* internal KMSAN checks.
|
||||
*/
|
||||
while (size > 0) {
|
||||
page_offset = addr % PAGE_SIZE;
|
||||
page_offset = offset_in_page(addr);
|
||||
to_go = min(PAGE_SIZE - page_offset, (u64)size);
|
||||
kmsan_handle_dma_page((void *)addr, to_go, dir);
|
||||
addr += to_go;
|
||||
|
|
|
@ -145,7 +145,7 @@ void *kmsan_get_metadata(void *address, bool is_origin)
|
|||
return NULL;
|
||||
if (!page_has_metadata(page))
|
||||
return NULL;
|
||||
off = addr % PAGE_SIZE;
|
||||
off = offset_in_page(addr);
|
||||
|
||||
return (is_origin ? origin_ptr_for(page) : shadow_ptr_for(page)) + off;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue