From 06c67befeeb16f2995c11b0e04a348103ddbfab1 Mon Sep 17 00:00:00 2001 From: Lennert Buytenhek Date: Mon, 10 Jul 2006 04:45:27 -0700 Subject: [PATCH] make valid_mmap_phys_addr_range() take a pfn Newer ARMs have a 40 bit physical address space, but mapping physical memory above 4G needs a special page table format which we (currently?) do not use for userspace mappings, so what happens instead is that mapping an address >= 4G will happily discard the upper bits and wrap. There is a valid_mmap_phys_addr_range() arch hook where we could check for >= 4G addresses and deny the mapping, but this hook takes an unsigned long address: static inline int valid_mmap_phys_addr_range(unsigned long addr, size_t size); And drivers/char/mem.c:mmap_mem() calls it like this: static int mmap_mem(struct file * file, struct vm_area_struct * vma) { size_t size = vma->vm_end - vma->vm_start; if (!valid_mmap_phys_addr_range(vma->vm_pgoff << PAGE_SHIFT, size)) So that's not much help either. This patch makes the hook take a pfn instead of a phys address. Signed-off-by: Lennert Buytenhek Cc: Bjorn Helgaas Cc: "Luck, Tony" Cc: Russell King Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/ia64/pci/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/ia64/pci/pci.c') diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 276512fd892..60b45e79f08 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -650,7 +650,7 @@ pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma) * Avoid attribute aliasing. See Documentation/ia64/aliasing.txt * for more details. */ - if (!valid_mmap_phys_addr_range(vma->vm_pgoff << PAGE_SHIFT, size)) + if (!valid_mmap_phys_addr_range(vma->vm_pgoff, size)) return -EINVAL; prot = phys_mem_access_prot(NULL, vma->vm_pgoff, size, vma->vm_page_prot); -- cgit v1.2.3