Date: Sun, 15 Jul 2012 18:23:50 +0200 From: Christian Brueffer <brueffer@FreeBSD.org> To: Mateusz Guzik <mjguzik@gmail.com> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r238491 - head/sys/fs/smbfs Message-ID: <5002EE96.2060104@FreeBSD.org> In-Reply-To: <20120715160410.GA22600@dft-labs.eu> References: <201207151550.q6FFoCMo056166@svn.freebsd.org> <20120715160410.GA22600@dft-labs.eu>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7/15/12 18:04 , Mateusz Guzik wrote: > On Sun, Jul 15, 2012 at 03:50:12PM +0000, Christian Brueffer wrote: >> Author: brueffer >> Date: Sun Jul 15 15:50:12 2012 >> New Revision: 238491 >> URL: http://svn.freebsd.org/changeset/base/238491 >> >> Log: >> Save a bzero() by using M_ZERO. >> >> Obtained from: Dragonfly BSD (change 4faaf07c3d7ddd120deed007370aaf4d90b72ebb) >> MFC after: 2 weeks >> >> Modified: >> head/sys/fs/smbfs/smbfs_node.c >> >> Modified: head/sys/fs/smbfs/smbfs_node.c >> ============================================================================== >> --- head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:23:31 2012 (r238490) >> +++ head/sys/fs/smbfs/smbfs_node.c Sun Jul 15 15:50:12 2012 (r238491) >> @@ -223,7 +223,7 @@ loop: >> if (fap == NULL) >> return ENOENT; >> >> - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK); >> + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); >> error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); >> if (error) { >> free(np, M_SMBNODE); >> @@ -235,7 +235,6 @@ loop: >> return (error); >> } >> vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; >> - bzero(np, sizeof(*np)); >> vp->v_data = np; >> np->n_vnode = vp; >> np->n_mount = VFSTOSMBFS(mp); > > How about moving this malloc right before np is actually used? > While here some style(9) fixes. > > http://people.freebsd.org/~mjg/patches/smbfs_node-malloc.patch > > Completely untested (even compile-time); I guess the idea is clear. :) > Looks good to me. Want to give your shiny new commit bit a spin? ;-) If not, I'll handle it. Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5002EE96.2060104>