aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc64/kernel/pci.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-20 09:03:38 +0100
committerIngo Molnar <mingo@elte.hu>2008-11-20 09:03:38 +0100
commit90accd6fabf9b2fa2705945a4c601877a75d43bf (patch)
treed393cb54f0228b1313139e4e14adf4f5cf236b59 /arch/sparc64/kernel/pci.c
parentb43d196c4d3fe46d6dda7c987c47792612b80b1b (diff)
parentee2f6cc7f9ea2542ad46070ed62ba7aa04d08871 (diff)
Merge branch 'linus' into x86/memory-corruption-check
Diffstat (limited to 'arch/sparc64/kernel/pci.c')
-rw-r--r--arch/sparc64/kernel/pci.c10
1 files changed, 9 insertions, 1 deletions
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;
}