Date: Mon, 22 Oct 2018 21:59:52 +0000 From: Rick Macklem <rmacklem@uoguelph.ca> To: Brooks Davis <brooks@freebsd.org> Cc: FreeBSD Current <freebsd-current@FreeBSD.org>, Josh Paetzel <josh@tcbug.org> Subject: Re: which way to update export_args structure? Message-ID: <YTOPR0101MB11628EFAE330DB521970206EDDF40@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM> In-Reply-To: <YTOPR0101MB1162CABEA06CC78BB5D5DA63DDF40@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM> References: <YTOPR0101MB182021549F8CF8277477A4C5DDE90@YTOPR0101MB1820.CANPRD01.PROD.OUTLOOK.COM> <20181003155133.GA57729@spindle.one-eyed-alien.net> <YTOPR0101MB18207FF98DED0232B9BB1B4FDDE50@YTOPR0101MB1820.CANPRD01.PROD.OUTLOOK.COM> <20181008170428.GB9766@spindle.one-eyed-alien.net> <YTOPR0101MB11626B32F73B520FBDA3C633DDFA0@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>, <20181022160508.GB45769@spindle.one-eyed-alien.net>, <YTOPR0101MB1162CABEA06CC78BB5D5DA63DDF40@YTOPR0101MB1162.CANPRD01.PROD.OUTLOOK.COM>
next in thread | previous in thread | raw e-mail | index | archive | help
________________________________________
From: owner-freebsd-current@freebsd.org <owner-freebsd-current@freebsd.org> on behalf of Rick Macklem <rmacklem@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?YTOPR0101MB11628EFAE330DB521970206EDDF40>
