diff mbox series

[v1,40/61] NFSD: Replace READ* macros in nfsd4_decode_exchange_id()

Message ID 160527995338.6186.13917579604098004455.stgit@klimt.1015granger.net (mailing list archive)
State New, archived
Headers show
Series Update NFSD XDR functions | expand

Commit Message

Chuck Lever Nov. 13, 2020, 3:05 p.m. UTC
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/nfs4xdr.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d3e238b538d0..6897078bde82 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1567,8 +1567,8 @@  static __be32
 nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 			 struct nfsd4_exchange_id *exid)
 {
-	DECODE_HEAD;
-	int dummy;
+	__be32 status;
+	u32 dummy;
 
 	status = nfsd4_decode_verifier4(argp, &exid->verifier);
 	if (status)
@@ -1577,16 +1577,16 @@  nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 	if (status)
 		goto out;
 
-	READ_BUF(4);
-	exid->flags = be32_to_cpup(p++);
+	if (xdr_stream_decode_u32(argp->xdr, &exid->flags) < 0)
+		goto xdr_error;
 
 	status = nfsd4_decode_state_protect4_a(argp, exid);
 	if (status)
 		goto out;
 
-	READ_BUF(4);    /* nfs_impl_id4 array length */
-	dummy = be32_to_cpup(p++);
-
+	/* nfs_impl_id4 array length */
+	if (xdr_stream_decode_u32(argp->xdr, &dummy) < 0)
+		goto xdr_error;
 	if (dummy > 1)
 		goto xdr_error;
 
@@ -1605,7 +1605,12 @@  nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 		if (status)
 			goto xdr_error;
 	}
-	DECODE_TAIL;
+
+	status = nfs_ok;
+out:
+	return status;
+xdr_error:
+	return nfserr_bad_xdr;
 }
 
 static __be32