diff options
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ip_esp.c | 13 | ||||
-rw-r--r-- | sys/netinet/ip_ipcomp.c | 10 |
2 files changed, 7 insertions, 16 deletions
diff --git a/sys/netinet/ip_esp.c b/sys/netinet/ip_esp.c index a348c53960f..cfd1148b1d5 100644 --- a/sys/netinet/ip_esp.c +++ b/sys/netinet/ip_esp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.c,v 1.100 2006/12/15 09:32:30 otto Exp $ */ +/* $OpenBSD: ip_esp.c,v 1.101 2007/10/03 10:52:11 krw Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -408,11 +408,9 @@ esp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) /* Get IPsec-specific opaque pointer */ if (esph == NULL || mtag != NULL) - MALLOC(tc, struct tdb_crypto *, sizeof(struct tdb_crypto), - M_XDATA, M_NOWAIT); + tc = malloc(sizeof(*tc), M_XDATA, M_NOWAIT | M_ZERO); else - MALLOC(tc, struct tdb_crypto *, - sizeof(struct tdb_crypto) + alen, M_XDATA, M_NOWAIT); + tc = malloc(sizeof(*tc) + alen, M_XDATA, M_NOWAIT | M_ZERO); if (tc == NULL) { m_freem(m); crypto_freereq(crp); @@ -421,7 +419,6 @@ esp_input(struct mbuf *m, struct tdb *tdb, int skip, int protoff) return ENOBUFS; } - bzero(tc, sizeof(struct tdb_crypto)); tc->tc_ptr = (caddr_t) mtag; if (esph) { @@ -961,8 +958,7 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, crda = crp->crp_desc; /* IPsec-specific opaque crypto info. */ - MALLOC(tc, struct tdb_crypto *, sizeof(struct tdb_crypto), - M_XDATA, M_NOWAIT); + tc = malloc(sizeof(*tc), M_XDATA, M_NOWAIT | M_ZERO); if (tc == NULL) { m_freem(m); crypto_freereq(crp); @@ -971,7 +967,6 @@ esp_output(struct mbuf *m, struct tdb *tdb, struct mbuf **mp, int skip, return ENOBUFS; } - bzero(tc, sizeof(struct tdb_crypto)); tc->tc_spi = tdb->tdb_spi; tc->tc_proto = tdb->tdb_sproto; bcopy(&tdb->tdb_dst, &tc->tc_dst, sizeof(union sockaddr_union)); diff --git a/sys/netinet/ip_ipcomp.c b/sys/netinet/ip_ipcomp.c index 3e07cb66eae..8f23dc0a906 100644 --- a/sys/netinet/ip_ipcomp.c +++ b/sys/netinet/ip_ipcomp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipcomp.c,v 1.20 2006/03/25 22:41:48 djm Exp $ */ +/* $OpenBSD: ip_ipcomp.c,v 1.21 2007/10/03 10:52:11 krw Exp $ */ /* * Copyright (c) 2001 Jean-Jacques Bernard-Gundol (jj@wabbitt.org) @@ -163,8 +163,7 @@ ipcomp_input(m, tdb, skip, protoff) return ENOBUFS; } /* Get IPsec-specific opaque pointer */ - MALLOC(tc, struct tdb_crypto *, sizeof(struct tdb_crypto), - M_XDATA, M_NOWAIT); + tc = malloc(sizeof(*tc), M_XDATA, M_NOWAIT | M_ZERO); if (tc == NULL) { m_freem(m); crypto_freereq(crp); @@ -172,7 +171,6 @@ ipcomp_input(m, tdb, skip, protoff) ipcompstat.ipcomps_crypto++; return ENOBUFS; } - bzero(tc, sizeof(struct tdb_crypto)); crdc = crp->crp_desc; crdc->crd_skip = skip + hlen; @@ -515,8 +513,7 @@ ipcomp_output(m, tdb, mp, skip, protoff) crdc->crd_alg = ipcompx->type; /* IPsec-specific opaque crypto info */ - MALLOC(tc, struct tdb_crypto *, sizeof(struct tdb_crypto), - M_XDATA, M_NOWAIT); + tc = malloc(sizeof(*tc), M_XDATA, M_NOWAIT | M_ZERO); if (tc == NULL) { m_freem(m); crypto_freereq(crp); @@ -524,7 +521,6 @@ ipcomp_output(m, tdb, mp, skip, protoff) ipcompstat.ipcomps_crypto++; return ENOBUFS; } - bzero(tc, sizeof(struct tdb_crypto)); tc->tc_spi = tdb->tdb_spi; tc->tc_proto = tdb->tdb_sproto; |