summaryrefslogtreecommitdiffstats
path: root/sys/vm
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2009-07-14 19:45:36 +0000
committerjhb <jhb@FreeBSD.org>2009-07-14 19:45:36 +0000
commitd81f73fcb520cff58dcafda0e644b91837b26a40 (patch)
treec7668a2a58d716a617574fb0350e77267a41f5ee /sys/vm
parent43717b21005a9b854b99f96a6c5ed015e8916d46 (diff)
downloadFreeBSD-src-d81f73fcb520cff58dcafda0e644b91837b26a40.zip
FreeBSD-src-d81f73fcb520cff58dcafda0e644b91837b26a40.tar.gz
- Change mmap() to fail requests with EINVAL that pass a length of 0. This
behavior is mandated by POSIX. - Do not fail requests that pass a length greater than SSIZE_MAX (such as > 2GB on 32-bit platforms). The 'len' parameter is actually an unsigned 'size_t' so negative values don't really make sense. Submitted by: Alexander Best alexbestms at math.uni-muenster.de Reviewed by: alc Approved by: re (kib) MFC after: 1 week
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_mmap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/vm/vm_mmap.c b/sys/vm/vm_mmap.c
index cc7a0f4..2b99e36 100644
--- a/sys/vm/vm_mmap.c
+++ b/sys/vm/vm_mmap.c
@@ -229,7 +229,7 @@ mmap(td, uap)
fp = NULL;
/* make sure mapping fits into numeric range etc */
- if ((ssize_t) uap->len < 0 ||
+ if (uap->len == 0 ||
((flags & MAP_ANON) && uap->fd != -1))
return (EINVAL);
OpenPOWER on IntegriCloud