________________________________________ 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. rickReceived on Mon Oct 22 2018 - 20:00:12 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:18 UTC