[PATCH] fix bogon in /dev/mem mmap'ing on nommu

From: Benjamin Herrenschmidt
Date: Wed Apr 11 2007 - 21:42:43 EST


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@xxxxxxxxxxxxxxxxxxx>
---

I suppose that can go in anytime, and probably in stable too, Dave ?

Index: linux-cell/drivers/char/mem.c
===================================================================
--- linux-cell.orig/drivers/char/mem.c 2007-02-12 10:36:14.000000000 +1100
+++ linux-cell/drivers/char/mem.c 2007-04-12 11:38:44.000000000 +1000
@@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_m
{
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 */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/