diff options
author | alc <alc@FreeBSD.org> | 2011-10-08 18:29:30 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2011-10-08 18:29:30 +0000 |
commit | e9db5a5a5020515a6b1c4c21b6784b5acc6e2aa3 (patch) | |
tree | b73d031565f4867144a3a6a0998d2cd3cd864935 /sys/kern | |
parent | 1e0c79103a9f1c3171d7440bd5822e46f32859f3 (diff) | |
download | FreeBSD-src-e9db5a5a5020515a6b1c4c21b6784b5acc6e2aa3.zip FreeBSD-src-e9db5a5a5020515a6b1c4c21b6784b5acc6e2aa3.tar.gz |
Fix the handling of an empty kmem map by sysctl_kmem_map_free(). In
the unlikely event that sysctl_kmem_map_free() was performed on an
empty kmem map, it would incorrectly report the free space as zero.
Discussed with: avg
MFC after: 1 week
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_malloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index 7843cae..b4c45fa 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -265,8 +265,8 @@ sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS) u_long size; vm_map_lock_read(kmem_map); - size = kmem_map->root != NULL ? - kmem_map->root->max_free : kmem_map->size; + size = kmem_map->root != NULL ? kmem_map->root->max_free : + kmem_map->max_offset - kmem_map->min_offset; vm_map_unlock_read(kmem_map); return (sysctl_handle_long(oidp, &size, 0, req)); } |