Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ARM: Remove address checking for MMUless devices

Commit 169f9102f9198b ("ARM: 9350/1: fault: Implement
copy_from_kernel_nofault_allowed()") added the function to check address
before use. However, for devices without MMU, addr > TASK_SIZE will
always fail. This patch move this function after the #ifdef CONFIG_MMU
statement.

Signed-off-by: Yanjun Yang <yangyj.ee@gmail.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218953
Fixes: 169f9102f9198b ("ARM: 9350/1: fault: Implement copy_from_kernel_nofault_allowed()")
Link: https://lore.kernel.org/r/20240611100947.32241-1-yangyj.ee@gmail.com
Signed-off-by: Kees Cook <kees@kernel.org>

authored by

Yanjun Yang and committed by
Kees Cook
3ccea478 18c18b1f

+2 -2
+2 -2
arch/arm/mm/fault.c
··· 25 25 26 26 #include "fault.h" 27 27 28 + #ifdef CONFIG_MMU 29 + 28 30 bool copy_from_kernel_nofault_allowed(const void *unsafe_src, size_t size) 29 31 { 30 32 unsigned long addr = (unsigned long)unsafe_src; 31 33 32 34 return addr >= TASK_SIZE && ULONG_MAX - addr >= size; 33 35 } 34 - 35 - #ifdef CONFIG_MMU 36 36 37 37 /* 38 38 * This is useful to dump out the page tables associated with