which way to update export_args structure?

Rick Macklem rmacklem at uoguelph.ca
Mon Oct 22 22:00:12 UTC 2018


________________________________________
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.

rick



More information about the freebsd-current mailing list