Date: Thu, 17 Jan 2013 13:39:30 +0400 From: Gleb Smirnoff <glebius@FreeBSD.org> To: "Andrey V. Elsukov" <ae@FreeBSD.org> Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org Subject: Re: svn commit: r245529 - user/ae/inet6/sys/netinet6 Message-ID: <20130117093930.GK96599@FreeBSD.org> In-Reply-To: <201301170230.r0H2UWLd056719@svn.freebsd.org> References: <201301170230.r0H2UWLd056719@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 17, 2013 at 02:30:32AM +0000, Andrey V. Elsukov wrote: A> Author: ae A> Date: Thu Jan 17 02:30:32 2013 A> New Revision: 245529 A> URL: http://svnweb.freebsd.org/changeset/base/245529 A> A> Log: A> Use M_ZERO flag instead of explicit bzero call after malloc. A> A> Modified: A> user/ae/inet6/sys/netinet6/in6.c A> A> Modified: user/ae/inet6/sys/netinet6/in6.c A> ============================================================================== A> --- user/ae/inet6/sys/netinet6/in6.c Thu Jan 17 02:23:40 2013 (r245528) A> +++ user/ae/inet6/sys/netinet6/in6.c Thu Jan 17 02:30:32 2013 (r245529) A> @@ -2703,17 +2703,13 @@ in6_domifattach(struct ifnet *ifp) A> { A> struct in6_ifextra *ext; A> A> - ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, M_WAITOK); A> - bzero(ext, sizeof(*ext)); A> - A> - ext->in6_ifstat = (struct in6_ifstat *)malloc(sizeof(struct in6_ifstat), A> - M_IFADDR, M_WAITOK); A> - bzero(ext->in6_ifstat, sizeof(*ext->in6_ifstat)); A> - A> + ext = (struct in6_ifextra *)malloc(sizeof(*ext), M_IFADDR, A> + M_WAITOK | M_ZERO); A> + ext->in6_ifstat = (struct in6_ifstat *)malloc( A> + sizeof(struct in6_ifstat), M_IFADDR, M_WAITOK | M_ZERO); A> ext->icmp6_ifstat = A> (struct icmp6_ifstat *)malloc(sizeof(struct icmp6_ifstat), A> - M_IFADDR, M_WAITOK); A> - bzero(ext->icmp6_ifstat, sizeof(*ext->icmp6_ifstat)); A> + M_IFADDR, M_WAITOK | M_ZERO); A> A> ext->nd_ifinfo = nd6_ifattach(ifp); A> ext->scope6_id = scope6_ifattach(ifp); A> @@ -2723,10 +2719,9 @@ in6_domifattach(struct ifnet *ifp) A> ext->lltable->llt_lookup = in6_lltable_lookup; A> ext->lltable->llt_dump = in6_lltable_dump; A> } A> - A> ext->mld_ifinfo = mld_domifattach(ifp); A> A> - return ext; A> + return (ext); A> } A> A> void Since your commit improves style(9), you could also remove casts before malloc(). -- Totus tuus, Glebius.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130117093930.GK96599>