From owner-freebsd-current@freebsd.org Mon Oct 22 22:01:36 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56A41FD8B6C for ; Mon, 22 Oct 2018 22:01:36 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00EBF769BA; Mon, 22 Oct 2018 22:01:35 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id 2FD363C475F; Mon, 22 Oct 2018 22:01:35 +0000 (UTC) Date: Mon, 22 Oct 2018 22:01:35 +0000 From: Brooks Davis To: Rick Macklem Cc: Brooks Davis , FreeBSD Current , Josh Paetzel Subject: Re: which way to update export_args structure? Message-ID: <20181022220135.GA96662@spindle.one-eyed-alien.net> References: <20181003155133.GA57729@spindle.one-eyed-alien.net> <20181008170428.GB9766@spindle.one-eyed-alien.net> <20181022160508.GB45769@spindle.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u3/rZRmxL6MmkK24" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2018 22:01:36 -0000 --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 22, 2018 at 09:59:52PM +0000, Rick Macklem wrote: >=20 > ________________________________________ > From: owner-freebsd-current@freebsd.org on behalf of Rick Macklem > Sent: Monday, October 22, 2018 5:24 PM > To: Brooks Davis > Cc: FreeBSD Current; Josh Paetzel > Subject: Re: which way to update export_args structure? >=20 > Brooks Davis wrote: > On Sat, Oct 20, 2018 at 01:17:37AM +0000, Rick Macklem wrote: > [lots of stuff snipped] > >> + if (vfs_getopt(mp->mnt_optnew, "export", &bufp, &len) = =3D=3D 0) { > >> + /* Assume that there is only 1 ABI for each leng= th. */ > >> + switch (len) { > >> + case (sizeof(struct oexport_args)): > >> + case (sizeof(struct o2export_args)): > ... > >> + memset(&o2export, 0, sizeof(o2export)); > > > >This is certainly redundant given that you immediately copy over it. > Actually, I just looked and this code is correct. The trick is that "len"= might > equal sizeof(struct oexport_args) which is < sizeof(struct o2export_args). > As such, the memcpy() may only replace the first fields of "struct o2expo= rt_args". > I've added a comment to the patch to clarify this. Ah, that makes sense. -- Brooks --u3/rZRmxL6MmkK24 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJbzki+AAoJEKzQXbSebgfAokIH/3YpNlWA/ssiR4NB/I7rbhOL EGGSKuQSzxtqjwQL7vA65z2HK2dpJ9hFOogEj/zNBGpmp0FJuHWTX/dLY9Z5W/PD yIANbLUkwKhhyGuEBoRl5d/X031Kl+CdOPkLBSGrDeC4f92wy7CtisT1Ss+pY85B lBs2mOZ01tKucyHRHUOLT+T0STJHMff1ZTtdINFTi1Y4TUVFjrLHpX6pJs+SHkjK 6H46gUQUxrTn/Q0FGMb3OOxDTsNuwybaI84EEfxeC1Eimfdz14BsabPFqafQpmI2 nuo6RwNBPHNQGIoTAL3vOd89EfD5khtqpeiWqpm/M/XNA7p56K5yiRhdBIpt+mQ= =/6MX -----END PGP SIGNATURE----- --u3/rZRmxL6MmkK24--