From: Anna Schumaker Date: Wed, 30 Nov 2022 18:15:25 +0000 (-0500) Subject: NFSv4.2: Set the correct size scratch buffer for decoding READ_PLUS X-Git-Tag: v6.1.8~1476 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6a174755c330fe30ba023c4511ce1caf51a7ce1;p=platform%2Fkernel%2Flinux-starfive.git NFSv4.2: Set the correct size scratch buffer for decoding READ_PLUS [ Upstream commit 36357fe74ef736524a29fbd3952948768510a8b9 ] 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: d3b00a802c84 ("NFS: Replace the READ_PLUS decoding code") Signed-off-by: Anna Schumaker Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index fe1aeb0..2fd465c 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -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]);