diff options
author | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2007-12-09 21:24:59 +0000 |
---|---|---|
committer | Hans-Joerg Hoexer <hshoexer@cvs.openbsd.org> | 2007-12-09 21:24:59 +0000 |
commit | 7d967d95931a7d563790a10d82d7d978f1ae5e19 (patch) | |
tree | e54069fe09eaed70f8fa6c68f691cf26990f6b98 /sys/netinet6 | |
parent | e8ae77fe5f0db451d4017c44a1d9459558697e8b (diff) |
take advantage of M_ZERO
ok claudio gilles
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/frag6.c | 10 | ||||
-rw-r--r-- | sys/netinet6/in6.c | 23 | ||||
-rw-r--r-- | sys/netinet6/nd6_nbr.c | 5 |
3 files changed, 13 insertions, 25 deletions
diff --git a/sys/netinet6/frag6.c b/sys/netinet6/frag6.c index 1f5f6f17b23..bcf2387b73a 100644 --- a/sys/netinet6/frag6.c +++ b/sys/netinet6/frag6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: frag6.c,v 1.24 2007/05/01 03:38:45 ray Exp $ */ +/* $OpenBSD: frag6.c,v 1.25 2007/12/09 21:24:58 hshoexer Exp $ */ /* $KAME: frag6.c,v 1.40 2002/05/27 21:40:31 itojun Exp $ */ /* @@ -285,11 +285,9 @@ frag6_input(mp, offp, proto) else if (frag6_nfragpackets >= (u_int)ip6_maxfragpackets) goto dropfrag; frag6_nfragpackets++; - q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FTABLE, - M_DONTWAIT); + q6 = malloc(sizeof(*q6), M_FTABLE, M_DONTWAIT | M_ZERO); if (q6 == NULL) goto dropfrag; - bzero(q6, sizeof(*q6)); frag6_insque(q6, &ip6q); @@ -378,11 +376,9 @@ frag6_input(mp, offp, proto) } } - ip6af = (struct ip6asfrag *)malloc(sizeof(struct ip6asfrag), M_FTABLE, - M_DONTWAIT); + ip6af = malloc(sizeof(*ip6af), M_FTABLE, M_DONTWAIT | M_ZERO); if (ip6af == NULL) goto dropfrag; - bzero(ip6af, sizeof(*ip6af)); ip6af->ip6af_head = ip6->ip6_flow; ip6af->ip6af_len = ip6->ip6_plen; ip6af->ip6af_nxt = ip6->ip6_nxt; diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 05fa7db2e70..94f00a193a5 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.72 2006/11/17 01:11:23 itojun Exp $ */ +/* $OpenBSD: in6.c,v 1.73 2007/12/09 21:24:58 hshoexer Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -907,11 +907,9 @@ in6_update_ifa(ifp, ifra, ia) * RA, it is called under an interrupt context. So, we should * call malloc with M_NOWAIT. */ - ia = (struct in6_ifaddr *) malloc(sizeof(*ia), M_IFADDR, - M_NOWAIT); + ia = malloc(sizeof(*ia), M_IFADDR, M_NOWAIT | M_ZERO); if (ia == NULL) return (ENOBUFS); - bzero((caddr_t)ia, sizeof(*ia)); LIST_INIT(&ia->ia6_memberships); /* Initialize the address and masks, and put time stamp */ ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; @@ -1742,9 +1740,8 @@ in6_createmkludge(ifp) return; } - mk = malloc(sizeof(*mk), M_IPMADDR, M_WAITOK); + mk = malloc(sizeof(*mk), M_IPMADDR, M_WAITOK | M_ZERO); - bzero(mk, sizeof(*mk)); LIST_INIT(&mk->mk_head); mk->mk_ifp = ifp; LIST_INSERT_HEAD(&in6_mk, mk, mk_entry); @@ -2621,17 +2618,13 @@ in6_domifattach(ifp) { struct in6_ifextra *ext; - ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK); - bzero(ext, sizeof(*ext)); + ext = malloc(sizeof(*ext), M_IFADDR, M_WAITOK | M_ZERO); - ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat), - M_IFADDR, M_WAITOK); - bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat)); + ext->in6_ifstat = malloc(sizeof(*ext->in6_ifstat), M_IFADDR, + M_WAITOK | M_ZERO); - ext->icmp6_ifstat = - (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat), - M_IFADDR, M_WAITOK); - bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat)); + ext->icmp6_ifstat = malloc(sizeof(*ext->icmp6_ifstat), M_IFADDR, + M_WAITOK | M_ZERO); ext->nd_ifinfo = nd6_ifattach(ifp); return ext; diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index 411bc6fb3f2..6168ed52a84 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6_nbr.c,v 1.45 2007/06/08 09:31:38 henning Exp $ */ +/* $OpenBSD: nd6_nbr.c,v 1.46 2007/12/09 21:24:58 hshoexer Exp $ */ /* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */ /* @@ -1103,7 +1103,7 @@ nd6_dad_start(ifa, tick) return; } - dp = malloc(sizeof(*dp), M_IP6NDP, M_NOWAIT); + dp = malloc(sizeof(*dp), M_IP6NDP, M_NOWAIT | M_ZERO); if (dp == NULL) { log(LOG_ERR, "nd6_dad_start: memory allocation failed for " "%s(%s)\n", @@ -1111,7 +1111,6 @@ nd6_dad_start(ifa, tick) ifa->ifa_ifp ? ifa->ifa_ifp->if_xname : "???"); return; } - bzero(dp, sizeof(*dp)); bzero(&dp->dad_timer_ch, sizeof(dp->dad_timer_ch)); TAILQ_INSERT_TAIL(&dadq, (struct dadq *)dp, dad_list); |