summaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_map.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index 4f7aadc..9e40e95 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -358,6 +358,9 @@ mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
mapping->prot = prot | PROT_USER;
map_start = __ALIGN_DOWN(va, GRANULE);
+ /* Ensure the length is aligned */
+ len = __ALIGN_UP(len + misalign, GRANULE);
+
/*
* Now we check what type of map request
* this is.
@@ -409,7 +412,7 @@ mmap(void *addr, size_t len, int prot, int flags, int fildes, off_t off)
}
/* Setup map_end and map ranges */
- map_end = map_start + __ALIGN_UP(len + misalign, GRANULE);
+ map_end = map_start + len;
mapping->range.start = map_start;
mapping->range.end = map_end;
mapping->physmem_base = physmem;