From: Benjamin Herrenschmidt Date: Tue, 17 Apr 2007 05:53:16 +0000 (-0700) Subject: fix bogon in /dev/mem mmap'ing on nommu X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8a93258ce302c2b597289770cb7de8dba7c6c219;p=openwrt%2Fstaging%2Fblogic.git fix bogon in /dev/mem mmap'ing on nommu 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 Acked-By: David Howells Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/mem.c b/drivers/char/mem.c index f5c160caf9f4..5f066963f171 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -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 */