Skip to content

Commit cd2e999

Browse files
committed
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>
1 parent 3dcd1d8 commit cd2e999

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

fs/nfsd/nfs4xdr.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -277,21 +277,10 @@ nfsd4_decode_verifier4(struct nfsd4_compoundargs *argp, nfs4_verifier *verf)
277277
static __be32
278278
nfsd4_decode_bitmap4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen)
279279
{
280-
u32 i, count;
281-
__be32 *p;
282-
283-
if (xdr_stream_decode_u32(argp->xdr, &count) < 0)
284-
return nfserr_bad_xdr;
285-
/* request sanity */
286-
if (count > 1000)
287-
return nfserr_bad_xdr;
288-
p = xdr_inline_decode(argp->xdr, count << 2);
289-
if (!p)
290-
return nfserr_bad_xdr;
291-
for (i = 0; i < bmlen; i++)
292-
bmval[i] = (i < count) ? be32_to_cpup(p++) : 0;
280+
ssize_t status;
293281

294-
return nfs_ok;
282+
status = xdr_stream_decode_uint32_array(argp->xdr, bmval, bmlen);
283+
return status == -EBADMSG ? nfserr_bad_xdr : nfs_ok;
295284
}
296285

297286
static __be32

0 commit comments

Comments
 (0)