]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSD: Replace READ* macros in nfsd4_decode_listxattrs()
authorChuck Lever <chuck.lever@oracle.com>
Wed, 4 Nov 2020 16:04:02 +0000 (11:04 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Jun 2024 12:52:44 +0000 (14:52 +0200)
[ Upstream commit 2212036cadf4da3c4b0e4bd2a9a8c3d78617ab4f ]

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfsd/nfs4xdr.c

index 38610764d71613cda7b7a7af5dfdde9c51efeb62..bf8eacab64952d1cbcee41f7d4107b20ece5933c 100644 (file)
@@ -2223,11 +2223,10 @@ static __be32
 nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp,
                        struct nfsd4_listxattrs *listxattrs)
 {
-       DECODE_HEAD;
        u32 maxcount;
 
-       READ_BUF(12);
-       p = xdr_decode_hyper(p, &listxattrs->lsxa_cookie);
+       if (xdr_stream_decode_u64(argp->xdr, &listxattrs->lsxa_cookie) < 0)
+               return nfserr_bad_xdr;
 
        /*
         * If the cookie  is too large to have even one user.x attribute
@@ -2237,7 +2236,8 @@ nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp,
            (XATTR_LIST_MAX / (XATTR_USER_PREFIX_LEN + 2)))
                return nfserr_badcookie;
 
-       maxcount = be32_to_cpup(p++);
+       if (xdr_stream_decode_u32(argp->xdr, &maxcount) < 0)
+               return nfserr_bad_xdr;
        if (maxcount < 8)
                /* Always need at least 2 words (length and one character) */
                return nfserr_inval;
@@ -2245,7 +2245,7 @@ nfsd4_decode_listxattrs(struct nfsd4_compoundargs *argp,
        maxcount = min(maxcount, svc_max_payload(argp->rqstp));
        listxattrs->lsxa_maxcount = maxcount;
 
-       DECODE_TAIL;
+       return nfs_ok;
 }
 
 static __be32