NFSD: Replace READ* macros in nfsd4_decode_getdeviceinfo()
[ Upstream commit 044959715f370b24870c95df3940add8710c5a29 ] Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7a3ff0295c
commit
8f773fb898
1 changed files with 28 additions and 20 deletions
|
@ -638,6 +638,21 @@ nfsd4_decode_state_owner4(struct nfsd4_compoundargs *argp,
|
||||||
return nfsd4_decode_opaque(argp, owner);
|
return nfsd4_decode_opaque(argp, owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_NFSD_PNFS
|
||||||
|
static __be32
|
||||||
|
nfsd4_decode_deviceid4(struct nfsd4_compoundargs *argp,
|
||||||
|
struct nfsd4_deviceid *devid)
|
||||||
|
{
|
||||||
|
__be32 *p;
|
||||||
|
|
||||||
|
p = xdr_inline_decode(argp->xdr, NFS4_DEVICEID4_SIZE);
|
||||||
|
if (!p)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
memcpy(devid, p, sizeof(*devid));
|
||||||
|
return nfs_ok;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_NFSD_PNFS */
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
nfsd4_decode_sessionid4(struct nfsd4_compoundargs *argp,
|
nfsd4_decode_sessionid4(struct nfsd4_compoundargs *argp,
|
||||||
struct nfs4_sessionid *sessionid)
|
struct nfs4_sessionid *sessionid)
|
||||||
|
@ -1765,27 +1780,20 @@ static __be32
|
||||||
nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
|
nfsd4_decode_getdeviceinfo(struct nfsd4_compoundargs *argp,
|
||||||
struct nfsd4_getdeviceinfo *gdev)
|
struct nfsd4_getdeviceinfo *gdev)
|
||||||
{
|
{
|
||||||
DECODE_HEAD;
|
__be32 status;
|
||||||
u32 num, i;
|
|
||||||
|
|
||||||
READ_BUF(sizeof(struct nfsd4_deviceid) + 3 * 4);
|
status = nfsd4_decode_deviceid4(argp, &gdev->gd_devid);
|
||||||
COPYMEM(&gdev->gd_devid, sizeof(struct nfsd4_deviceid));
|
if (status)
|
||||||
gdev->gd_layout_type = be32_to_cpup(p++);
|
return status;
|
||||||
gdev->gd_maxcount = be32_to_cpup(p++);
|
if (xdr_stream_decode_u32(argp->xdr, &gdev->gd_layout_type) < 0)
|
||||||
num = be32_to_cpup(p++);
|
return nfserr_bad_xdr;
|
||||||
if (num) {
|
if (xdr_stream_decode_u32(argp->xdr, &gdev->gd_maxcount) < 0)
|
||||||
if (num > 1000)
|
return nfserr_bad_xdr;
|
||||||
goto xdr_error;
|
if (xdr_stream_decode_uint32_array(argp->xdr,
|
||||||
READ_BUF(4 * num);
|
&gdev->gd_notify_types, 1) < 0)
|
||||||
gdev->gd_notify_types = be32_to_cpup(p++);
|
return nfserr_bad_xdr;
|
||||||
for (i = 1; i < num; i++) {
|
|
||||||
if (be32_to_cpup(p++)) {
|
return nfs_ok;
|
||||||
status = nfserr_inval;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DECODE_TAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
|
|
Loading…
Add table
Reference in a new issue