[PATCH] ARM: ioremap: fix boundary check when reusing static mapping
Nicolas Pitre
nico at fluxnic.net
Sun Jan 29 10:13:33 EST 2012
On Sun, 29 Jan 2012, Russell King - ARM Linux wrote:
> On Sun, Jan 29, 2012 at 03:33:35PM +0100, Joachim Eastwood wrote:
> > <1>ioremap: pfn=fffff phys=fffff000 offset=400 size=1000
> > <1>ioremap: area c3ffdfc0: phys_addr=200000 pfn=200 size=4000
> > <1>ioremap: found: addr fef74000 => fed73000 => fed73400
>
> Ok, first thing is that patch 7304/1 is utter crap. The reason is simple -
> 'size' here:
>
> if (__phys_to_pfn(area->phys_addr) > pfn ||
> __pfn_to_phys(pfn) + offset + size-1 >
> area->phys_addr + area->size-1)
> continue;
>
> _already_ contains 'offset', as we've only _just_ done this a few lines
> above the loop:
>
> size = PAGE_ALIGN(offset + size);
>
> So, 'size' includes the requested offset *already*.
Bah, indeed. OK, I feel better now for not having made this basic
mistake in the first place, but not any better overall since I didn't
review Pawel's patch thoroughly enough on the basis that his "fix" made
things work for him.
> In any case, I don't think it matters, and I'm going to schedule a revert
> of that crap commit. So, Joachim, well spotted.
For the revert:
Acked-by: Nicolas Pitre <nico at linaro.org>
Nicolas
More information about the linux-arm-kernel
mailing list