NFSD: De-duplicate nfsd4_decode_bitmap4()
Clean up. Trond points out that xdr_stream_decode_uint32_array() does the same thing as nfsd4_decode_bitmap4(). Suggested-by: Trond Myklebust <trondmy@hammerspace.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
3dcd1d8aab
commit
cd2e999c7c
|
@ -277,21 +277,10 @@ nfsd4_decode_verifier4(struct nfsd4_compoundargs *argp, nfs4_verifier *verf)
|
||||||
static __be32
|
static __be32
|
||||||
nfsd4_decode_bitmap4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen)
|
nfsd4_decode_bitmap4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen)
|
||||||
{
|
{
|
||||||
u32 i, count;
|
ssize_t status;
|
||||||
__be32 *p;
|
|
||||||
|
|
||||||
if (xdr_stream_decode_u32(argp->xdr, &count) < 0)
|
status = xdr_stream_decode_uint32_array(argp->xdr, bmval, bmlen);
|
||||||
return nfserr_bad_xdr;
|
return status == -EBADMSG ? nfserr_bad_xdr : nfs_ok;
|
||||||
/* request sanity */
|
|
||||||
if (count > 1000)
|
|
||||||
return nfserr_bad_xdr;
|
|
||||||
p = xdr_inline_decode(argp->xdr, count << 2);
|
|
||||||
if (!p)
|
|
||||||
return nfserr_bad_xdr;
|
|
||||||
for (i = 0; i < bmlen; i++)
|
|
||||||
bmval[i] = (i < count) ? be32_to_cpup(p++) : 0;
|
|
||||||
|
|
||||||
return nfs_ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
|
|
Loading…
Reference in New Issue