From: Xiubo Li <Li.Xiubo@freescale.com>
To: <linux@arm.linux.org.uk>, <lauraa@codeaurora.org>,
<linux-arm-kernel@lists.infradead.org>, <nico@linaro.org>,
<santosh.shilimkar@ti.com>, <iamjoonsoo.kim@lge.com>,
<superlibj8301@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, Xiubo Li <Li.Xiubo@freescale.com>
Subject: [PATCH v3] arm: ioremap: Fix static vm area boundary check.
Date: Fri, 16 May 2014 17:35:20 +0800 [thread overview]
Message-ID: <1400232920-25079-1-git-send-email-Li.Xiubo@freescale.com> (raw)
For each vmalloc area, there is one guard page at the end of it.
so the vm->size = PAGE_ALIGN(offset + request size) + guard page size.
Signed-off-by: Richard Lee <superlibj8301@gmail.com>
Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
arch/arm/mm/ioremap.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index be69333..758e8f7 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -49,14 +49,18 @@ static struct static_vm *find_static_vm_paddr(phys_addr_t paddr,
struct vm_struct *vm;
list_for_each_entry(svm, &static_vmlist, list) {
+ phys_addr_t paddr_end, phys_addr_end;
+
vm = &svm->vm;
if (!(vm->flags & VM_ARM_STATIC_MAPPING))
continue;
if ((vm->flags & VM_ARM_MTYPE_MASK) != VM_ARM_MTYPE(mtype))
continue;
- if (vm->phys_addr > paddr ||
- paddr + size - 1 > vm->phys_addr + vm->size - 1)
+ /* The PAGE_SIZE here is vmalloc area's guard page */
+ phys_addr_end = vm->phys_addr + vm->size - PAGE_SIZE - 1;
+ paddr_end = paddr + size - 1;
+ if (vm->phys_addr > paddr || paddr_end > phys_addr_end)
continue;
return svm;
--
1.8.4
next reply other threads:[~2014-05-16 10:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 9:35 Xiubo Li [this message]
2014-05-16 18:11 ` Nicolas Pitre
2014-05-19 2:49 ` Li.Xiubo
2014-05-20 3:13 ` Nicolas Pitre
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=1400232920-25079-1-git-send-email-Li.Xiubo@freescale.com \
--to=li.xiubo@freescale.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=lauraa@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nico@linaro.org \
--cc=santosh.shilimkar@ti.com \
--cc=superlibj8301@gmail.com \
/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®