Skip to content

Commit 9384d79

Browse files
xp4ns3akpm00
authored andcommitted
mm/highmem: delete memmove_page()
Matthew Wilcox reported that, while he was looking at memmove_page(), he realized that it can't actually work. The reasons are hidden in its implementation, which makes use of memmove() on logical addresses provided by kmap_local_page(). memmove() does the wrong thing when it tests "if (dest <= src)". Therefore, delete memmove_page(). No need to change any other code because we have no call sites of memmove_page() across the whole kernel. Link: https://lkml.kernel.org/r/20220606141533.555-1-fmdefrancesco@gmail.com Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Reported-by: Matthew Wilcox <willy@infradead.org> Reviewed-by: Baoquan He <bhe@redhat.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 673520f commit 9384d79

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

include/linux/highmem.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -336,19 +336,6 @@ static inline void memcpy_page(struct page *dst_page, size_t dst_off,
336336
kunmap_local(dst);
337337
}
338338

339-
static inline void memmove_page(struct page *dst_page, size_t dst_off,
340-
struct page *src_page, size_t src_off,
341-
size_t len)
342-
{
343-
char *dst = kmap_local_page(dst_page);
344-
char *src = kmap_local_page(src_page);
345-
346-
VM_BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE);
347-
memmove(dst + dst_off, src + src_off, len);
348-
kunmap_local(src);
349-
kunmap_local(dst);
350-
}
351-
352339
static inline void memset_page(struct page *page, size_t offset, int val,
353340
size_t len)
354341
{

0 commit comments

Comments
 (0)