Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5787
b: refs/heads/master
c: 4bb8255
h: refs/heads/master
i:
  5785: 552536a
  5783: cb0f184
v: v3
  • Loading branch information
Linus Torvalds committed Aug 13, 2005
1 parent b270972 commit 57a0500
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2da5bf80f754e28cc153362e5ed1edaa9740897a
refs/heads/master: 4bb82551e165f887448f6f61055d7bcd90aefa2a
12 changes: 8 additions & 4 deletions trunk/drivers/char/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,22 @@ 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
* for. Perhaps should add a new macro here.
*
* 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);
}

Expand Down

0 comments on commit 57a0500

Please sign in to comment.