RE: [PATCH v3] NFSD: Remove open coding of string copy

From: David Laight
Date: Tue May 16 2023 - 10:36:47 EST


From: Chuck Lever III
> Sent: 16 May 2023 15:11
>
> > On May 16, 2023, at 5:33 AM, David Laight <David.Laight@xxxxxxxxxx> wrote:
> >
> > From: Azeem Shaikh
> >> Sent: 15 May 2023 03:41
> >>
> >> Instead of open coding a __dynamic_array(), use the __string() and
> >> __assign_str() helper macros that exist for this kind of use case.
> >
> > Is this actually a dynamic array, or just a char[8] ?
> > On 64 bit copying a short fixed-length string is far better
> > than any kind of dynamic sized allocation.
>
> I'd prefer to use a string helper, since the netid is a string,
> and this documents the data type better and it is not subject
> to sudden breakage if someone creates a standard netid longer
> than 8 characters.
>
> The nfsd_cb_setup tracepoint is not in a performance-sensitive
> path.
>
> In addition, trace consumers should be able to count on the
> string helpers to perform memory copies without overrunning
> either the source or destination buffers... one less source
> of error.

That is an entirely different justification :-)

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)