summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2010-01-15 18:20:24 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2010-01-15 18:20:24 +0000
commitefe15de128add506fb4055690c47221eb73d6346 (patch)
tree865f1922996f1e3e9a3218150ac4c08a5913f99e /sys
parent11fef8fbaba31074be2bcaa88ef3f2ecc33861f6 (diff)
Replace pool_get() + bzero() with pool_get(..., PR_ZERO).
With input from oga@ and krw@ ok oga@ krw@ thib@ markus@ mk@
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/in_pcb.c5
-rw-r--r--sys/netinet/ip_spd.c9
-rw-r--r--sys/netinet/tcp_input.c6
-rw-r--r--sys/netinet/tcp_subr.c5
4 files changed, 9 insertions, 16 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index 848ed63bcda..55487b77f38 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.110 2009/12/23 07:40:31 guenther Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.111 2010/01/15 18:20:23 chl Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -188,10 +188,9 @@ in_pcballoc(so, v)
"inpcbpl", NULL);
inpcb_pool_initialized = 1;
}
- inp = pool_get(&inpcb_pool, PR_NOWAIT);
+ inp = pool_get(&inpcb_pool, PR_NOWAIT|PR_ZERO);
if (inp == NULL)
return (ENOBUFS);
- bzero((caddr_t)inp, sizeof(*inp));
inp->inp_table = table;
inp->inp_socket = so;
inp->inp_seclevel[SL_AUTH] = ipsec_auth_default_level;
diff --git a/sys/netinet/ip_spd.c b/sys/netinet/ip_spd.c
index 77d28487e2b..876ba82a1ae 100644
--- a/sys/netinet/ip_spd.c
+++ b/sys/netinet/ip_spd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_spd.c,v 1.59 2009/01/27 22:40:10 bluhm Exp $ */
+/* $OpenBSD: ip_spd.c,v 1.60 2010/01/15 18:20:23 chl Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
@@ -621,12 +621,10 @@ ipsec_add_policy(struct inpcb *inp, int af, int direction)
0, 0, 0, "ipsec policy", NULL);
}
- ipon = pool_get(&ipsec_policy_pool, PR_NOWAIT);
+ ipon = pool_get(&ipsec_policy_pool, PR_NOWAIT|PR_ZERO);
if (ipon == NULL)
return NULL;
- bzero(ipon, sizeof(struct ipsec_policy));
-
ipon->ipo_ref_count = 1;
ipon->ipo_flags |= IPSP_POLICY_SOCKET;
@@ -775,11 +773,10 @@ ipsp_acquire_sa(struct ipsec_policy *ipo, union sockaddr_union *gw,
0, 0, 0, "ipsec acquire", NULL);
}
- ipa = pool_get(&ipsec_acquire_pool, 0);
+ ipa = pool_get(&ipsec_acquire_pool, PR_ZERO);
if (ipa == NULL)
return ENOMEM;
- bzero(ipa, sizeof(struct ipsec_acquire));
bcopy(gw, &ipa->ipa_addr, sizeof(union sockaddr_union));
timeout_set(&ipa->ipa_timeout, ipsp_delete_acquire, ipa);
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 1d112c9f5de..bdab2ababdd 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_input.c,v 1.230 2009/11/13 20:54:05 claudio Exp $ */
+/* $OpenBSD: tcp_input.c,v 1.231 2010/01/15 18:20:23 chl Exp $ */
/* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */
/*
@@ -4022,7 +4022,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
return (1);
}
- sc = pool_get(&syn_cache_pool, PR_NOWAIT);
+ sc = pool_get(&syn_cache_pool, PR_NOWAIT|PR_ZERO);
if (sc == NULL) {
if (ipopts)
(void) m_free(ipopts);
@@ -4033,8 +4033,6 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
* Fill in the cache, and put the necessary IP and TCP
* options into the reply.
*/
- bzero(sc, sizeof(struct syn_cache));
- bzero(&sc->sc_timer, sizeof(sc->sc_timer));
bcopy(src, &sc->sc_src, src->sa_len);
bcopy(dst, &sc->sc_dst, dst->sa_len);
sc->sc_rdomain = sotoinpcb(so)->inp_rdomain;
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 26cba61037b..5cd48cce9c8 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_subr.c,v 1.109 2009/11/13 20:54:05 claudio Exp $ */
+/* $OpenBSD: tcp_subr.c,v 1.110 2010/01/15 18:20:23 chl Exp $ */
/* $NetBSD: tcp_subr.c,v 1.22 1996/02/13 23:44:00 christos Exp $ */
/*
@@ -462,10 +462,9 @@ tcp_newtcpcb(struct inpcb *inp)
struct tcpcb *tp;
int i;
- tp = pool_get(&tcpcb_pool, PR_NOWAIT);
+ tp = pool_get(&tcpcb_pool, PR_NOWAIT|PR_ZERO);
if (tp == NULL)
return ((struct tcpcb *)0);
- bzero((char *) tp, sizeof(struct tcpcb));
TAILQ_INIT(&tp->t_segq);
tp->t_maxseg = tcp_mssdflt;
tp->t_maxopd = 0;