mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li.Xiubo@freescale.com" <Li.Xiubo@freescale.com>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: "linux@arm.linux.org.uk" <linux@arm.linux.org.uk>,
	"lauraa@codeaurora.org" <lauraa@codeaurora.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"santosh.shilimkar@ti.com" <santosh.shilimkar@ti.com>,
	"iamjoonsoo.kim@lge.com" <iamjoonsoo.kim@lge.com>,
	"superlibj8301@gmail.com" <superlibj8301@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v3] arm: ioremap: Fix static vm area boundary check.
Date: Mon, 19 May 2014 02:49:26 +0000	[thread overview]
Message-ID: <9258c0b00a33484a8d289378047f8cd4@BY2PR03MB505.namprd03.prod.outlook.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1405161403400.17310@knanqh.ubzr>

> > 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.
> 
> Nope.  There is no guard page for statically created vmalloc areas.
> 

Yes, you are right, I'm thinking why the static area has no guard page?

Thanks very much,

BRs
Xiubo


> 
> > 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
> >

  reply	other threads:[~2014-05-19  2:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-16  9:35 Xiubo Li
2014-05-16 18:11 ` Nicolas Pitre
2014-05-19  2:49   ` Li.Xiubo [this message]
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=9258c0b00a33484a8d289378047f8cd4@BY2PR03MB505.namprd03.prod.outlook.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=nicolas.pitre@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®