The patch titled Subject: mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem-fix has been added to the -mm mm-unstable branch. Its filename is mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem-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: Mike Rapoport <rppt@xxxxxxxxxx> Subject: mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem-fix Date: Tue, 31 Jan 2023 20:41:49 +0200 The generic pfn_valid() does not take into account pfn_offset when it compares it with max_mapnr. Link: https://lkml.kernel.org/r/Y9lg7R1Yd931C+y5@xxxxxxxxxx Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxx> Reported-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx> Tested-by: Conor Dooley <conor.dooley@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/asm-generic/memory_model.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/asm-generic/memory_model.h~mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem-fix +++ a/include/asm-generic/memory_model.h @@ -26,7 +26,7 @@ static inline int pfn_valid(unsigned lon extern unsigned long max_mapnr; unsigned long pfn_offset = ARCH_PFN_OFFSET; - return pfn >= pfn_offset && pfn < max_mapnr; + return pfn >= pfn_offset && (pfn - pfn_offset) < max_mapnr; } #define pfn_valid pfn_valid #endif _ Patches currently in -mm which might be from rppt@xxxxxxxxxx are mm-sparse-fix-unused-function-pgdat_to_phys-warning.patch arm-include-asm-generic-memory_modelh-from-pageh-rather-than-memoryh.patch m68k-use-asm-generic-memory_modelh-for-both-mmu-and-mmu.patch mips-drop-definition-of-pfn_valid-for-discontigmem.patch mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem.patch mm-arch-add-generic-implementation-of-pfn_valid-for-flatmem-fix.patch