powerpc: Fix sysfs pci mmap on 32-bit machines with 64-bit PCI

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Wednesday, October 15, 2008 - 12:05 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=7c12d9...
Commit:     7c12d906f4ef690c65e60111375856640f63a545
Parent:     76c31f239ea221a6c84bd26141262a43bfe8b7f4
Author:     Benjamin Herrenschmidt <benh@kernel.crashing.org>
AuthorDate: Wed Oct 1 15:30:04 2008 +0000
Committer:  Benjamin Herrenschmidt <benh@kernel.crashing.org>
CommitDate: Tue Oct 7 14:26:21 2008 +1100

    powerpc: Fix sysfs pci mmap on 32-bit machines with 64-bit PCI
    
    When manipulating 64-bit PCI addresses, the code would lose the
    top 32-bit in a couple of places when shifting a pfn due to missing
    type casting from the 32-bit pfn to a 64-bit resource before the
    shift.
    
    This breaks using newer X servers for example on 440 machines
    with the PCI bus above 32-bit.
    
    Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/kernel/pci-common.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 52ccfed..8c02709 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -419,7 +419,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
 	struct pci_dev *pdev = NULL;
 	struct resource *found = NULL;
 	unsigned long prot = pgprot_val(protection);
-	unsigned long offset = pfn << PAGE_SHIFT;
+	resource_size_t offset = ((resource_size_t)pfn) << PAGE_SHIFT;
 	int i;
 
 	if (page_is_ram(pfn))
@@ -470,7 +470,8 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
 int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 			enum pci_mmap_state mmap_state, int write_combine)
 {
-	resource_size_t offset = vma->vm_pgoff << PAGE_SHIFT;
+	resource_size_t offset =
+		((resource_size_t)vma->vm_pgoff) << PAGE_SHIFT;
 	struct resource *rp;
 	int ret;
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
powerpc: Fix sysfs pci mmap on 32-bit machines with 64-bit PCI, Linux Kernel Mailing ..., (Wed Oct 15, 12:05 pm)