diff -uprN linux-source-2.6.26/arch/sparc64/kernel/pci.c linux-source-2.6.26.pci-fixed/arch/sparc64/kernel/pci.c --- linux-source-2.6.26/arch/sparc64/kernel/pci.c 2008-07-14 01:51:29.000000000 +0400 +++ linux-source-2.6.26.pci-fixed/arch/sparc64/kernel/pci.c 2008-10-31 01:23:54.000000000 +0300 @@ -1017,6 +1017,7 @@ static int __pci_mmap_make_offset(struct for (i = 0; i <= PCI_ROM_RESOURCE; i++) { struct resource *rp = &pdev->resource[i]; + resource_size_t aligned_end; /* Active? */ if (!rp->flags) @@ -1034,8 +1035,15 @@ static int __pci_mmap_make_offset(struct continue; } + /* Align the resource end to the next page address. + * PAGE_SIZE intentionally added instead of (PAGE_SIZE - 1), + * because actually we need the address of the next byte + * after rp->end. + */ + aligned_end = (rp->end + PAGE_SIZE) & PAGE_MASK; + if ((rp->start <= user_paddr) && - (user_paddr + user_size) <= (rp->end + 1UL)) + (user_paddr + user_size) <= aligned_end) break; }