X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Fsparc64%2Fkernel%2Fpci.c;h=bdb7c0a6d83ddaf57cf01d78dde54887c827e982;hb=1b6bcdbe7eaacde19b5d633b33c8d056e4818de0;hp=242ac1ccae7d5866b3beac630780cf501cb26f45;hpb=975f6b0c1b0efb66db455d2e76bacba06cc65541;p=linux-2.6-omap-h63xx.git diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c index 242ac1ccae7..bdb7c0a6d83 100644 --- a/arch/sparc64/kernel/pci.c +++ b/arch/sparc64/kernel/pci.c @@ -889,6 +889,7 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev, for (i = 0; i <= PCI_ROM_RESOURCE; i++) { struct resource *rp = &pdev->resource[i]; + resource_size_t aligned_end; /* Active? */ if (!rp->flags) @@ -906,8 +907,15 @@ static int __pci_mmap_make_offset(struct pci_dev *pdev, 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; }