Skip to content

Commit 403366a

Browse files
committed
NFSD: Replace READ* macros in nfsd4_decode_setxattr()
Signed-off-by: Chuck Lever <[email protected]>
1 parent 830c715 commit 403366a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/nfsd/nfs4xdr.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,11 +2184,11 @@ static __be32
21842184
nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp,
21852185
struct nfsd4_setxattr *setxattr)
21862186
{
2187-
DECODE_HEAD;
21882187
u32 flags, maxcount, size;
2188+
__be32 status;
21892189

2190-
READ_BUF(4);
2191-
flags = be32_to_cpup(p++);
2190+
if (xdr_stream_decode_u32(argp->xdr, &flags) < 0)
2191+
return nfserr_bad_xdr;
21922192

21932193
if (flags > SETXATTR4_REPLACE)
21942194
return nfserr_inval;
@@ -2201,8 +2201,8 @@ nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp,
22012201
maxcount = svc_max_payload(argp->rqstp);
22022202
maxcount = min_t(u32, XATTR_SIZE_MAX, maxcount);
22032203

2204-
READ_BUF(4);
2205-
size = be32_to_cpup(p++);
2204+
if (xdr_stream_decode_u32(argp->xdr, &size) < 0)
2205+
return nfserr_bad_xdr;
22062206
if (size > maxcount)
22072207
return nfserr_xattr2big;
22082208

@@ -2211,12 +2211,12 @@ nfsd4_decode_setxattr(struct nfsd4_compoundargs *argp,
22112211
struct xdr_buf payload;
22122212

22132213
if (!xdr_stream_subsegment(argp->xdr, &payload, size))
2214-
goto xdr_error;
2214+
return nfserr_bad_xdr;
22152215
status = nfsd4_vbuf_from_vector(argp, &payload,
22162216
&setxattr->setxa_buf, size);
22172217
}
22182218

2219-
DECODE_TAIL;
2219+
return nfs_ok;
22202220
}
22212221

22222222
static __be32

0 commit comments

Comments
 (0)