________________________________________ From: owner-freebsd-curr...@freebsd.org <owner-freebsd-curr...@freebsd.org> on behalf of Rick Macklem <rmack...@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. rick _______________________________________________ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"