From: linux@armlinux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: mm: fix set_memory_*() bounds checks
Date: Tue, 29 Nov 2016 17:59:20 +0000 [thread overview]
Message-ID: <20161129175920.GZ14217@n2100.armlinux.org.uk> (raw)
In-Reply-To: <24932a5a-4cbf-dd84-2e87-de29b07da5b3@ti.com>
On Tue, Nov 29, 2016 at 09:25:19AM -0600, Dave Gerlach wrote:
> Hi,
> On 11/21/2016 10:08 AM, Russell King wrote:
> >+static bool in_range(unsigned long start, unsigned long size,
> >+ unsigned long range_start, unsigned long range_end)
> >+{
> >+ return start >= range_start && start < range_end &&
> >+ size <= range_end - start;
> >+}
> >+
> > static int change_memory_common(unsigned long addr, int numpages,
> > pgprot_t set_mask, pgprot_t clear_mask)
> > {
> >- unsigned long start = addr;
> >- unsigned long size = PAGE_SIZE*numpages;
> >- unsigned long end = start + size;
> >+ unsigned long start = addr & PAGE_SIZE;
>
> This doesn't work as is, I believe 'start' should be set to
> PAGE_ALIGN(addr), addr & PAGE_SIZE as it is doesn't make sense. If I make
> this change this code works ok.
You're right, but we want to round 'addr' _down_, not up as PAGE_ALIGN()
will do. So that should've been PAGE_MASK.
--
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
next prev parent reply other threads:[~2016-11-29 17:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-21 16:08 [PATCH 1/2] ARM: mm: fix set_memory_*() bounds checks Russell King
2016-11-29 15:25 ` Dave Gerlach
2016-11-29 17:59 ` Russell King - ARM Linux [this message]
2017-01-06 16:29 ` Dave Gerlach
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=20161129175920.GZ14217@n2100.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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