From: "Zhao Gongyi" <zhaogongyi@bytedance.com>
To: "Catalin Marinas" <catalin.marinas@arm.com>
Cc: "Will Deacon" <will@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arm64: mm: validate /dev/mem mmap ranges without overflow
Date: Wed, 4 Nov 2026 10:21:24 +0800 [thread overview]
Message-ID: <3d26a89a-7fa2-4daa-a919-82708410d104@bytedance.com> (raw)
In-Reply-To: <aun4-MXVMZNrmvGr@arm.com>
Hi Catalin,
On 11/3/26 11:08 PM, Catalin Marinas wrote:
>
> Can we write this as:
>
> int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
> {
> phys_addr_t limit = PHYS_MASK + 1;
>
> return size <= limit && pfn <= (limit - size) >> PAGE_SHIFT;
> }
>
> It would resemble the generic __access_ok() better where we need to
> check for similar overflow. I find it easier to read.
>
> (happy to make the change when applying)
>
Thanks, your version is clearer. Please feel free to make the change
when applying.
Thanks,
Gongyi
next prev parent reply other threads:[~2026-11-04 2:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 17:10 Zhao Gongyi
2026-11-03 15:08 ` Catalin Marinas
2026-11-04 2:21 ` Zhao Gongyi [this message]
2026-11-04 19:04 ` Catalin Marinas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3d26a89a-7fa2-4daa-a919-82708410d104@bytedance.com \
--to=zhaogongyi@bytedance.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®