Messages in this thread Patch in this message | | | Date | Tue, 15 Jun 2010 18:53:54 +0200 | From | Florian Zumbiehl <> | Subject | [PATCH] Wrong page aligned size calculation in ioremapping code |
| |
Hi,
over the years since when I last reported this (and then lost track of it) this has been fixed in most places/architectures - but two instances still remain (or have appeared newly?), so here is the fix, and this time I'm gonna make sure it gets applied ;-)
The patch is untested, but I guess it's simple enough ...
Florian --------------------------------------------------------------------------- parisc __ioremap()/x86 early_iounmap(): fix off-by-one error in page alignment of allocation size for sizes where size%PAGE_SIZE==1.
Signed-off-by: Florian Zumbiehl <florz@florz.de>
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c index 92d496a..838d025 100644 --- a/arch/parisc/mm/ioremap.c +++ b/arch/parisc/mm/ioremap.c @@ -71,7 +71,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l */ offset = phys_addr & ~PAGE_MASK; phys_addr &= PAGE_MASK; - size = PAGE_ALIGN(last_addr) - phys_addr; + size = PAGE_ALIGN(last_addr + 1) - phys_addr; /* * Ok, go for it.. diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 12e4d2d..a4643e5 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c @@ -613,7 +613,7 @@ void __init early_iounmap(void __iomem *addr, unsigned long size) return; } offset = virt_addr & ~PAGE_MASK; - nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT; + nrpages = PAGE_ALIGN(offset + size) >> PAGE_SHIFT; idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot; while (nrpages > 0) {
| |