2005-03-21 10:33:33

by Hong Liu

[permalink] [raw]
Subject: [PATCH 2.6] fix mmap() return value to conform to POSIX

POSIX said:
mmap() should return [EOVERFLOW] if the file is a regular file and the
value of off + len exceeds the offset maximum established in the open
file description associated with fildes.

--- a/mm/mmap.c.orig 2005-03-16 14:08:59.116052416 +0800
+++ b/mm/mmap.c 2005-03-16 14:10:16.167338840 +0800
@@ -906,7 +906,7 @@ unsigned long do_mmap_pgoff(struct file

/* offset overflow? */
if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
- return -EINVAL;
+ return -EOVERFLOW;

/* Too many mappings? */
if (mm->map_count > sysctl_max_map_count)