Skip to content

Commit

Permalink
NFSv4.2: Set the correct size scratch buffer for decoding READ_PLUS
Browse files Browse the repository at this point in the history
[ Upstream commit 36357fe ]

The scratch_buf array is 16 bytes, but I was passing 32 to the
xdr_set_scratch_buffer() function. Fix this by using sizeof(), which is
what I probably should have been doing this whole time.

Fixes: d3b00a8 ("NFS: Replace the READ_PLUS decoding code")
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
amschuma-ntap authored and gregkh committed Dec 31, 2022
1 parent 05acc40 commit f6a1747
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfs/nfs42xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
if (!segs)
return -ENOMEM;

xdr_set_scratch_buffer(xdr, &scratch_buf, 32);
xdr_set_scratch_buffer(xdr, &scratch_buf, sizeof(scratch_buf));
status = -EIO;
for (i = 0; i < segments; i++) {
status = decode_read_plus_segment(xdr, &segs[i]);
Expand Down

0 comments on commit f6a1747

Please sign in to comment.