Commit cbd9abb3 authored by Chuck Lever's avatar Chuck Lever

NFSD: Replace READ* macros in nfsd4_decode_commit()

Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent d3d2f381
...@@ -581,13 +581,11 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close) ...@@ -581,13 +581,11 @@ nfsd4_decode_close(struct nfsd4_compoundargs *argp, struct nfsd4_close *close)
static __be32 static __be32
nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit)
{ {
DECODE_HEAD; if (xdr_stream_decode_u64(argp->xdr, &commit->co_offset) < 0)
return nfserr_bad_xdr;
READ_BUF(12); if (xdr_stream_decode_u32(argp->xdr, &commit->co_count) < 0)
p = xdr_decode_hyper(p, &commit->co_offset); return nfserr_bad_xdr;
commit->co_count = be32_to_cpup(p++); return nfs_ok;
DECODE_TAIL;
} }
static __be32 static __be32
......
...@@ -571,6 +571,27 @@ xdr_stream_decode_u32(struct xdr_stream *xdr, __u32 *ptr) ...@@ -571,6 +571,27 @@ xdr_stream_decode_u32(struct xdr_stream *xdr, __u32 *ptr)
return 0; return 0;
} }
/**
* xdr_stream_decode_u64 - Decode a 64-bit integer
* @xdr: pointer to xdr_stream
* @ptr: location to store 64-bit integer
*
* Return values:
* %0 on success
* %-EBADMSG on XDR buffer overflow
*/
static inline ssize_t
xdr_stream_decode_u64(struct xdr_stream *xdr, __u64 *ptr)
{
const size_t count = sizeof(*ptr);
__be32 *p = xdr_inline_decode(xdr, count);
if (unlikely(!p))
return -EBADMSG;
xdr_decode_hyper(p, ptr);
return 0;
}
/** /**
* xdr_stream_decode_opaque_fixed - Decode fixed length opaque xdr data * xdr_stream_decode_opaque_fixed - Decode fixed length opaque xdr data
* @xdr: pointer to xdr_stream * @xdr: pointer to xdr_stream
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment