The patch titled Subject: mm/highmem: VM_BUG_ON() if offset + len > PAGE_SIZE has been added to the -mm tree. Its filename is mm-highmem-vm_bug_on-if-offset-len-page_size.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-highmem-vm_bug_on-if-offset-len-page_size.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-highmem-vm_bug_on-if-offset-len-page_size.patch 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 and is updated there every 3-4 working days ------------------------------------------------------ From: "Fabio M. De Francesco" <fmdefrancesco@xxxxxxxxx> Subject: mm/highmem: VM_BUG_ON() if offset + len > PAGE_SIZE Add VM_BUG_ON() bounds checking to make sure that, if "offset + len> PAGE_SIZE", memset() does not corrupt data in adjacent pages. Mainly to match all the similar functions in highmem.h. Link: https://lkml.kernel.org/r/20220426193020.8710-1-fmdefrancesco@xxxxxxxxx Signed-off-by: Fabio M. De Francesco <fmdefrancesco@xxxxxxxxx> Cc: Ira Weiny <ira.weiny@xxxxxxxxx> Cc: Catalin Marinas <catalin.marinas@xxxxxxx> Cc: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Cc: Peter Collingbourne <pcc@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/highmem.h | 2 ++ 1 file changed, 2 insertions(+) --- a/include/linux/highmem.h~mm-highmem-vm_bug_on-if-offset-len-page_size +++ a/include/linux/highmem.h @@ -349,6 +349,8 @@ static inline void memcpy_to_page(struct static inline void memzero_page(struct page *page, size_t offset, size_t len) { char *addr = kmap_local_page(page); + + VM_BUG_ON(offset + len > PAGE_SIZE); memset(addr + offset, 0, len); flush_dcache_page(page); kunmap_local(addr); _ Patches currently in -mm which might be from fmdefrancesco@xxxxxxxxx are mm-highmem-fix-kernel-doc-warnings-in-highmemh.patch documentation-vm-include-kdocs-from-highmemh-into-highmemrst.patch documentation-vm-remove-using-kmap-atomic-from-highmemrst.patch documentation-vm-rework-temporary-virtual-mappings.patch mm-highmem-vm_bug_on-if-offset-len-page_size.patch