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

Yousef Alhouseen <[email protected]> Sat, 18 Jul 2026 05:20:35 -0700
Newsgroups gmane.linux.ports.sh.devel,gmane.linux.kernel,gmane.linux.ports.arm.kernel
Message-ID <CAMuQ4bWX3MR6JGt8CNcnWE95z=ZyFk7A7G+99z5Z0Qu=XHMj7w@mail.gmail.com>
Yes, agreed. The ARM and SH fixes should be folded into the original
generic char/mem change rather than sent separately. I'll resend them
together as a single v2.

Thanks,
Yousef

On Fri, 17 Jul 2026 16:17:25 +0200, Greg Kroah-Hartman
<[email protected]> wrote:
> 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