summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2009-05-02 12:54:42 +0000
committeroga <oga@openbsd.org>2009-05-02 12:54:42 +0000
commitc644662f9c45756cb9a8edc7b25e5a91e6dfc22f (patch)
tree512dd6a6fa50ec348b6ffeb837cf9bbd614c2ad8
parentcomment typo, no binary change (diff)
downloadwireguard-openbsd-c644662f9c45756cb9a8edc7b25e5a91e6dfc22f.tar.xz
wireguard-openbsd-c644662f9c45756cb9a8edc7b25e5a91e6dfc22f.zip
a few more memset changes.
two cases of pool_get() + memset(0) -> pool_get(,,,PR_ZERO) 1.5 cases of global variables are already zeroed, so don't zero them. ok ariane@, comments on stuff i'd missed from blambert@ and cnst@.
-rw-r--r--sys/uvm/uvm_aobj.c6
-rw-r--r--sys/uvm/uvm_init.c6
-rw-r--r--sys/uvm/uvm_map.c6
3 files changed, 6 insertions, 12 deletions
diff --git a/sys/uvm/uvm_aobj.c b/sys/uvm/uvm_aobj.c
index 4fd652fd32d..fb131b0036c 100644
--- a/sys/uvm/uvm_aobj.c
+++ b/sys/uvm/uvm_aobj.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_aobj.c,v 1.36 2009/03/20 15:19:04 oga Exp $ */
+/* $OpenBSD: uvm_aobj.c,v 1.37 2009/05/02 12:54:42 oga Exp $ */
/* $NetBSD: uvm_aobj.c,v 1.39 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -249,11 +249,9 @@ uao_find_swhash_elt(struct uvm_aobj *aobj, int pageidx, boolean_t create)
/*
* allocate a new entry for the bucket and init/insert it in
*/
- elt = pool_get(&uao_swhash_elt_pool, PR_WAITOK);
+ elt = pool_get(&uao_swhash_elt_pool, PR_WAITOK | PR_ZERO);
LIST_INSERT_HEAD(swhash, elt, list);
elt->tag = page_tag;
- elt->count = 0;
- memset(elt->slots, 0, sizeof(elt->slots));
return(elt);
}
diff --git a/sys/uvm/uvm_init.c b/sys/uvm/uvm_init.c
index 82bbb31e780..192a781a74f 100644
--- a/sys/uvm/uvm_init.c
+++ b/sys/uvm/uvm_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_init.c,v 1.20 2009/03/20 15:19:04 oga Exp $ */
+/* $OpenBSD: uvm_init.c,v 1.21 2009/05/02 12:54:42 oga Exp $ */
/* $NetBSD: uvm_init.c,v 1.14 2000/06/27 17:29:23 mrg Exp $ */
/*
@@ -81,10 +81,8 @@ uvm_init(void)
}
/*
- * step 1: zero the uvm structure
+ * step 1: set up stats.
*/
-
- memset(&uvm, 0, sizeof(uvm));
averunnable.fscale = FSCALE;
/*
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 75abac9c9f2..8858a585027 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.109 2009/03/25 20:00:18 oga Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.110 2009/05/02 12:54:42 oga Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -3191,7 +3191,7 @@ uvmspace_alloc(vaddr_t min, vaddr_t max, boolean_t pageable,
struct vmspace *vm;
UVMHIST_FUNC("uvmspace_alloc"); UVMHIST_CALLED(maphist);
- vm = pool_get(&uvm_vmspace_pool, PR_WAITOK);
+ vm = pool_get(&uvm_vmspace_pool, PR_WAITOK | PR_ZERO);
uvmspace_init(vm, NULL, min, max, pageable, remove_holes);
UVMHIST_LOG(maphist,"<- done (vm=%p)", vm,0,0,0);
return (vm);
@@ -3209,8 +3209,6 @@ uvmspace_init(struct vmspace *vm, struct pmap *pmap, vaddr_t min, vaddr_t max,
{
UVMHIST_FUNC("uvmspace_init"); UVMHIST_CALLED(maphist);
- memset(vm, 0, sizeof(*vm));
-
uvm_map_setup(&vm->vm_map, min, max, pageable ? VM_MAP_PAGEABLE : 0);
if (pmap)