From c4fb0c6fbf51223a88ba8974da172773f1842c5e Mon Sep 17 00:00:00 2001 From: Max Dmitrichenko Date: Sun, 2 Nov 2008 00:34:10 -0700 Subject: [PATCH] --- yaml --- r: 118354 b: refs/heads/master c: 5769907ade8dda7002b304c03ef9e4ee5c1e0821 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/sparc64/kernel/pci.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 3b000138400c..aabdafb75d12 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a1995a6599044076e2e13512ffbcecc49865e63e +refs/heads/master: 5769907ade8dda7002b304c03ef9e4ee5c1e0821 diff --git a/trunk/arch/sparc64/kernel/pci.c b/trunk/arch/sparc64/kernel/pci.c index 242ac1ccae7d..bdb7c0a6d83d 100644 --- a/trunk/arch/sparc64/kernel/pci.c +++ b/trunk/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; }