]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fix bogon in /dev/mem mmap'ing on nommu
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 17 Apr 2007 05:53:16 +0000 (22:53 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 2 May 2007 00:06:00 +0000 (17:06 -0700)
While digging through my MAP_FIXED changes, I found that rather obvious
bug in /dev/mem mmap implementation for nommu archs. get_unmapped_area()
is expected to return an address, not a pfn.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-By: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/char/mem.c

index f5c160caf9f480978db2cb0698192268433370ae..5f066963f171b5c9ff3a321b77e32798ee14be39 100644 (file)
@@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_mem(struct file *file,
 {
        if (!valid_mmap_phys_addr_range(pgoff, len))
                return (unsigned long) -EINVAL;
-       return pgoff;
+       return pgoff << PAGE_SHIFT;
 }
 
 /* can't do an in-place private mapping if there's no MMU */