The patch titled Subject: highmem: memcpy_{from,to}_folio() fix has been added to the -mm mm-unstable branch. Its filename is highmem-add-memcpy_to_folio-and-memcpy_from_folio-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/highmem-add-memcpy_to_folio-and-memcpy_from_folio-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andreas Gruenbacher <agruenba@xxxxxxxxxx> Subject: highmem: memcpy_{from,to}_folio() fix Date: Wed, 2 Aug 2023 16:43:54 +0200 memcpy_to_folio() and memcpy_from_folio() compute the size of the chunk of memory they can copy for each page, but then they don't use the chunk size in the actual memcpy. Fix that. Also, git rid of superfluous parentheses in these two functions. Link: https://lkml.kernel.org/r/20230802144354.1023099-1-agruenba@xxxxxxxxxx Fixes: 520a10fe2d72 ("highmem: add memcpy_to_folio() and memcpy_from_folio()") Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx> Cc: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/highmem.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/include/linux/highmem.h~highmem-add-memcpy_to_folio-and-memcpy_from_folio-fix +++ a/include/linux/highmem.h @@ -445,13 +445,13 @@ static inline void memcpy_from_folio(cha VM_BUG_ON(offset + len > folio_size(folio)); do { - char *from = kmap_local_folio(folio, offset); + const char *from = kmap_local_folio(folio, offset); size_t chunk = len; if (folio_test_highmem(folio) && - (chunk > (PAGE_SIZE - offset_in_page(offset)))) + chunk > PAGE_SIZE - offset_in_page(offset)) chunk = PAGE_SIZE - offset_in_page(offset); - memcpy(to, from, len); + memcpy(to, from, chunk); kunmap_local(from); from += chunk; @@ -470,9 +470,9 @@ static inline void memcpy_to_folio(struc size_t chunk = len; if (folio_test_highmem(folio) && - (chunk > (PAGE_SIZE - offset_in_page(offset)))) + chunk > PAGE_SIZE - offset_in_page(offset)) chunk = PAGE_SIZE - offset_in_page(offset); - memcpy(to, from, len); + memcpy(to, from, chunk); kunmap_local(to); from += chunk; _ Patches currently in -mm which might be from agruenba@xxxxxxxxxx are highmem-add-memcpy_to_folio-and-memcpy_from_folio-fix.patch