svn commit: r245529 - user/ae/inet6/sys/netinet6

Andrey V. Elsukov ae at FreeBSD.org
Thu Jan 17 02:30:32 UTC 2013


Author: ae
Date: Thu Jan 17 02:30:32 2013
New Revision: 245529
URL: http://svnweb.freebsd.org/changeset/base/245529

Log:
  Use M_ZERO flag instead of explicit bzero call after malloc.

Modified:
  user/ae/inet6/sys/netinet6/in6.c

Modified: user/ae/inet6/sys/netinet6/in6.c
==============================================================================
--- user/ae/inet6/sys/netinet6/in6.c	Thu Jan 17 02:23:40 2013	(r245528)
+++ user/ae/inet6/sys/netinet6/in6.c	Thu Jan 17 02:30:32 2013	(r245529)
@@ -2703,17 +2703,13 @@ in6_domifattach(struct ifnet *ifp)
 {
 	struct in6_ifextra *ext;
 
-	ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK);
-	bzero(ext, sizeof(*ext));
-
-	ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat),
-	    M_IFADDR, M_WAITOK);
-	bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat));
-
+	ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR,
+	    M_WAITOK | M_ZERO);
+	ext->in6_ifstat = (struct in6_ifstat *)malloc(
+	    sizeof(struct 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));
+	    M_IFADDR, M_WAITOK | M_ZERO);
 
 	ext->nd_ifinfo = nd6_ifattach(ifp);
 	ext->scope6_id = scope6_ifattach(ifp);
@@ -2723,10 +2719,9 @@ in6_domifattach(struct ifnet *ifp)
 		ext->lltable->llt_lookup = in6_lltable_lookup;
 		ext->lltable->llt_dump = in6_lltable_dump;
 	}
-
 	ext->mld_ifinfo = mld_domifattach(ifp);
 
-	return ext;
+	return (ext);
 }
 
 void


More information about the svn-src-user mailing list