From owner-svn-src-all@FreeBSD.ORG Mon Sep 24 04:28:15 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DC141065674; Mon, 24 Sep 2012 04:28:15 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id DB2CE8FC15; Mon, 24 Sep 2012 04:28:14 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8O4SDPY057884; Mon, 24 Sep 2012 07:28:13 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8O4S1fj004024; Mon, 24 Sep 2012 07:28:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8O4S128004023; Mon, 24 Sep 2012 07:28:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 24 Sep 2012 07:28:01 +0300 From: Konstantin Belousov To: Kevin Lo Message-ID: <20120924042801.GQ37286@deviant.kiev.zoral.com.ua> References: <201209230838.q8N8c6Tu056083@svn.freebsd.org> <20120923105220.GL37286@deviant.kiev.zoral.com.ua> <505FC00B.5020204@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="A+JrWpA8iZwaHvaR" Content-Disposition: inline In-Reply-To: <505FC00B.5020204@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Garrett Cooper , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: Re: svn commit: r240850 - head/lib/libstand X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Sep 2012 04:28:15 -0000 --A+JrWpA8iZwaHvaR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 24, 2012 at 10:06:03AM +0800, Kevin Lo wrote: > On 2012/09/24 03:27, Garrett Cooper wrote: > > On Sun, Sep 23, 2012 at 3:52 AM, Konstantin Belousov > > wrote: > >> On Sun, Sep 23, 2012 at 08:38:06AM +0000, Kevin Lo wrote: > >>> Author: kevlo > >>> Date: Sun Sep 23 08:38:06 2012 > >>> New Revision: 240850 > >>> URL: http://svn.freebsd.org/changeset/base/240850 > >>> > >>> Log: > >>> Avoid NULL dereference > >>> > >>> Modified: > >>> head/lib/libstand/nfs.c > > ... > > > >> I do not see how this change is useful. libstand' Free() function hand= les > >> NULL parameter fine, as well as all other free(3) implementations I am > >> aware of. > > +1. free(3) should silently ignore NULL parameters passed into it. >=20 > Well, The patch is harmless. I suppose I could argue it is a safety belt > against free(NULL) should be silently ignored. It is code bloat. > I have no problem changing it back, but there are two other places where > the same comment could apply. Yes, this is good to apply as well. >=20 > Index: lib/libstand/nfs.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- lib/libstand/nfs.c (revision 240879) > +++ lib/libstand/nfs.c (working copy) > @@ -606,10 +606,8 @@ nfs_open(const char *upath, struct open_file *f) > error =3D 0; >=20 > out: > - if (newfd) > - free(newfd); > - if (path) > - free(path); > + free(newfd); > + free(path); > #else > currfd->iodesc =3D desc; >=20 > @@ -1256,10 +1254,8 @@ nfs_open(const char *upath, struct open_file *f) > error =3D 0; >=20 > out: > - if (newfd) > - free(newfd); > - if (path) > - free(path); > + free(newfd); > + free(path); > #else > currfd->iodesc =3D desc; >=20 >=20 > > Thanks, > > Garrett > > >=20 > Kevin --A+JrWpA8iZwaHvaR Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBf4VAACgkQC3+MBN1Mb4ggZACfVhiiwDwkZ7D4ixXVVHMoSvc6 FTkAoK1g/WOn/HlG6kA7f5abtXmjcf9g =6NZP -----END PGP SIGNATURE----- --A+JrWpA8iZwaHvaR--