which way to update export_args structure?
Brooks Davis
brooks at freebsd.org
Mon Oct 22 22:01:36 UTC 2018
On Mon, Oct 22, 2018 at 09:59:52PM +0000, Rick Macklem wrote:
>
> ________________________________________
> From: owner-freebsd-current at freebsd.org <owner-freebsd-current at freebsd.org> on behalf of Rick Macklem <rmacklem at uoguelph.ca>
> 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?
>
> 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) == 0) {
> >> + /* Assume that there is only 1 ABI for each length. */
> >> + 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 o2export_args".
> I've added a comment to the patch to clarify this.
Ah, that makes sense.
-- Brooks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20181022/1e37f7d1/attachment.sig>
More information about the freebsd-current
mailing list