mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
nfsd: use xdr_encode_opaque_fixed for all GETXATTR fragments
nfsd4_vbuf_to_stream() encodes the first fragment and a short final fragment with xdr_encode_opaque_fixed(), but copies each full-page fragment in the loop with a bare memcpy(). A PAGE_SIZE fragment is a whole number of XDR words, so the memcpy() leaves no padding unwritten; the two code paths differ in form, not in result. Encode every fragment with xdr_encode_opaque_fixed(). The short-fragment branch then reduces to the loop exit, and the padding comment it carried goes with it. Suggested-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Aldo Ariel Panzardo <qwe.aldo@gmail.com> [ cel: Rewrote commit message ] Reviewed-by: Jeff Layton <jlayton@kernel.org> Link: https://patch.msgid.link/20260915173902.3184534-1-qwe.aldo@gmail.com Signed-off-by: Chuck Lever <cel@kernel.org>
This commit is contained in:
parent
fcc202d324
commit
fdce4109ec
|
|
@ -6368,17 +6368,9 @@ nfsd4_vbuf_to_stream(struct xdr_stream *xdr, char *buf, u32 buflen)
|
|||
if (!p)
|
||||
return nfserr_resource;
|
||||
|
||||
memcpy(p, buf, cplen);
|
||||
|
||||
if (cplen < PAGE_SIZE) {
|
||||
/*
|
||||
* We're done, with a length that wasn't page
|
||||
* aligned, so possibly not word aligned. Pad
|
||||
* any trailing bytes with 0.
|
||||
*/
|
||||
xdr_encode_opaque_fixed(p, NULL, cplen);
|
||||
xdr_encode_opaque_fixed(p, buf, cplen);
|
||||
if (cplen < PAGE_SIZE)
|
||||
break;
|
||||
}
|
||||
|
||||
buflen -= PAGE_SIZE;
|
||||
buf += PAGE_SIZE;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user