mmap/munmap with zero length
John Baldwin
jhb at freebsd.org
Mon Jul 13 18:44:45 UTC 2009
On Sunday 05 July 2009 3:32:25 am Alexander Best wrote:
> so mmap differs from the POSIX recommendation right. the malloc.conf option
> seems more like a workaround/hack. imo it's confusing to have mmap und munmap
> deal differently with len=0. being able to succesfully alocate memory which
> cannot be removed doesn't seem logical to me.
This should fix it:
--- //depot/user/jhb/acpipci/vm/vm_mmap.c
+++ /home/jhb/work/p4/acpipci/vm/vm_mmap.c
@@ -229,7 +229,7 @@
fp = NULL;
/* make sure mapping fits into numeric range etc */
- if ((ssize_t) uap->len < 0 ||
+ if ((ssize_t) uap->len <= 0 ||
((flags & MAP_ANON) && uap->fd != -1))
return (EINVAL);
--
John Baldwin
More information about the freebsd-hackers
mailing list