[PATCH 02/18] mm: use kunmap_local_dirty in memcpy_to_page

From: Christoph Hellwig
Date: Tue Jun 15 2021 - 09:26:30 EST


memcpy_to_page can write to potentially mapped page cache pages, so
use kunmap_local_dirty to make sure flush_kernel_dcache_pages is
called.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
include/linux/highmem.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 65f548db4f2d..d0497c0daf80 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -333,7 +333,7 @@ static inline void memcpy_to_page(struct page *page, size_t offset,

VM_BUG_ON(offset + len > PAGE_SIZE);
memcpy(to + offset, from, len);
- kunmap_local(to);
+ kunmap_local_dirty(page, to);
}

static inline void memzero_page(struct page *page, size_t offset, size_t len)
--
2.30.2