The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] Fix bound checking in do_mmap_pgoff()
@ 2004-09-19  8:07 Benjamin Herrenschmidt
  2004-09-19 12:59 ` Hugh Dickins
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2004-09-19  8:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel list, Linus Torvalds, Segher Boessenkool

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? */



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-19 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-19  8:07 [PATCH] Fix bound checking in do_mmap_pgoff() Benjamin Herrenschmidt
2004-09-19 12:59 ` Hugh Dickins
2004-09-19 13:09   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox