1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-23 16:01:42 +00:00

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
This commit is contained in:
Alan Cox 2011-10-08 18:29:30 +00:00
parent 04a382563d
commit 1549ed03ff
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226163

View File

@ -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));
}