diff options
author | Tony Luck <tony.luck@intel.com> | 2005-08-16 20:29:57 +0200 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-08-16 20:29:57 +0200 |
commit | f7001e8f1fa5369ee24f58255726a04a2019e4bd (patch) | |
tree | 1bbdd233ad0cf2e0adb4eb04f22b7bfa59a43494 /drivers/char/mem.c | |
parent | [IA64] update CONFIG_PCI description (diff) | |
parent | Merge master.kernel.org:/pub/scm/linux/kernel/git/aia21/ntfs-2.6 (diff) | |
download | linux-f7001e8f1fa5369ee24f58255726a04a2019e4bd.tar.xz linux-f7001e8f1fa5369ee24f58255726a04a2019e4bd.zip |
Auto-update from upstream
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r-- | drivers/char/mem.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 42187381506b..850a78c9c4bc 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -261,7 +261,11 @@ static int mmap_mem(struct file * file, struct vm_area_struct * vma) static int mmap_kmem(struct file * file, struct vm_area_struct * vma) { - unsigned long long val; + unsigned long pfn; + + /* Turn a kernel-virtual address into a physical page frame */ + pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT; + /* * RED-PEN: on some architectures there is more mapped memory * than available in mem_map which pfn_valid checks @@ -269,10 +273,10 @@ static int mmap_kmem(struct file * file, struct vm_area_struct * vma) * * RED-PEN: vmalloc is not supported right now. */ - if (!pfn_valid(vma->vm_pgoff)) + if (!pfn_valid(pfn)) return -EIO; - val = (u64)vma->vm_pgoff << PAGE_SHIFT; - vma->vm_pgoff = __pa(val) >> PAGE_SHIFT; + + vma->vm_pgoff = pfn; return mmap_mem(file, vma); } |