Re: [PATCH] char: mem: keep arch range checks overflow-safe

Greg Kroah-Hartman <[email protected]> Fri, 17 Jul 2026 16:17:25 +0200
Newsgroups org.kernel.vger.linux-sh,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <2026071710-flanked-espresso-5b06@gregkh>
On Thu, Jun 25, 2026 at 10:58:00AM +0200, Yousef Alhouseen wrote:
> The generic /dev/mem physical range check now avoids validating
> addr + size directly, but ARM and SH provide their own
> valid_phys_addr_range() implementations with the same wrapped-addition
> pattern.
> 
> Use subtraction-based upper-bound checks in those overrides as well. Also
> make the ARM mmap pfn check avoid overflowing the pfn plus page-count
> expression.
> 
> Suggested-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Yousef Alhouseen <[email protected]>
> ---
>  arch/arm/mm/mmap.c | 9 +++++++--
>  arch/sh/mm/mmap.c  | 4 +++-
>  2 files changed, 10 insertions(+), 3 deletions(-)

This should be part of the char/mem patch, right?

thanks,

greg k-h