Re: [PATCH] char: mem: keep arch range checks overflow-safe
From: Yousef Alhouseen
Date: Sat Jul 18 2026 - 08:20:44 EST
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
<gregkh@xxxxxxxxxxxxxxxxxxx> 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 <arnd@xxxxxxxx>
> > Signed-off-by: Yousef Alhouseen <alhouseenyousef@xxxxxxxxx>
> > ---
> > 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