]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFSv4.2: Set the correct size scratch buffer for decoding READ_PLUS
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 30 Nov 2022 18:15:25 +0000 (13:15 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 6 Dec 2022 17:28:35 +0000 (12:28 -0500)
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 <Anna.Schumaker@Netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs42xdr.c

index fe1aeb0f048f2b73bf2fbc92d0771fefac1b1716..2fd465cab631d28c9041e78687ebbf760a193177 100644 (file)
@@ -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]);