Messages in this thread Patch in this message | | | Subject | [PATCH] Fix bound checking in do_mmap_pgoff() | From | Benjamin Herrenschmidt <> | Date | Sun, 19 Sep 2004 18:07:15 +1000 |
| |
Hi !
A small issue has been forever in do_mmap_pgoff() in the boundary checking in the sense that it won't let you mmap with offset+len enclosing the last page of the "address space". For example, an mmap of /dev/mem won't let you map the last page of the physical address space (which I need for a ROM dump tool on pmac). This fixes it:
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
===== mm/mmap.c 1.144 vs edited ===== --- 1.144/mm/mmap.c 2004-09-03 19:08:17 +10:00 +++ edited/mm/mmap.c 2004-09-19 18:04:34 +10:00 @@ -801,7 +801,7 @@ return -EINVAL; /* offset overflow? */ - if ((pgoff + (len >> PAGE_SHIFT)) < pgoff) + if ((pgoff + (len >> PAGE_SHIFT) - 1) < pgoff) return -EINVAL; /* Too many mappings? */
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |