From owner-svn-src-user@FreeBSD.ORG Thu Jan 17 09:39:32 2013 Return-Path: Delivered-To: svn-src-user@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3C1A6CD0; Thu, 17 Jan 2013 09:39:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) by mx1.freebsd.org (Postfix) with ESMTP id A78DDF8B; Thu, 17 Jan 2013 09:39:31 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id r0H9dUAk001609; Thu, 17 Jan 2013 13:39:30 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id r0H9dUWE001608; Thu, 17 Jan 2013 13:39:30 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 17 Jan 2013 13:39:30 +0400 From: Gleb Smirnoff To: "Andrey V. Elsukov" Subject: Re: svn commit: r245529 - user/ae/inet6/sys/netinet6 Message-ID: <20130117093930.GK96599@FreeBSD.org> References: <201301170230.r0H2UWLd056719@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201301170230.r0H2UWLd056719@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@FreeBSD.org, svn-src-user@FreeBSD.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jan 2013 09:39:32 -0000 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.