diff options
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 83baf2bfe9e9..30913c83ccb0 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -3134,9 +3134,7 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp, | |||
3134 | len = maxcount; | 3134 | len = maxcount; |
3135 | v = 0; | 3135 | v = 0; |
3136 | 3136 | ||
3137 | thislen = (void *)xdr->end - (void *)xdr->p; | 3137 | thislen = min(len, ((void *)xdr->end - (void *)xdr->p)); |
3138 | if (len < thislen) | ||
3139 | thislen = len; | ||
3140 | p = xdr_reserve_space(xdr, (thislen+3)&~3); | 3138 | p = xdr_reserve_space(xdr, (thislen+3)&~3); |
3141 | WARN_ON_ONCE(!p); | 3139 | WARN_ON_ONCE(!p); |
3142 | resp->rqstp->rq_vec[v].iov_base = p; | 3140 | resp->rqstp->rq_vec[v].iov_base = p; |
@@ -3203,10 +3201,8 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, | |||
3203 | xdr_commit_encode(xdr); | 3201 | xdr_commit_encode(xdr); |
3204 | 3202 | ||
3205 | maxcount = svc_max_payload(resp->rqstp); | 3203 | maxcount = svc_max_payload(resp->rqstp); |
3206 | if (maxcount > xdr->buf->buflen - xdr->buf->len) | 3204 | maxcount = min_t(unsigned long, maxcount, (xdr->buf->buflen - xdr->buf->len)); |
3207 | maxcount = xdr->buf->buflen - xdr->buf->len; | 3205 | maxcount = min_t(unsigned long, maxcount, read->rd_length); |
3208 | if (maxcount > read->rd_length) | ||
3209 | maxcount = read->rd_length; | ||
3210 | 3206 | ||
3211 | if (!read->rd_filp) { | 3207 | if (!read->rd_filp) { |
3212 | err = nfsd_get_tmp_read_open(resp->rqstp, read->rd_fhp, | 3208 | err = nfsd_get_tmp_read_open(resp->rqstp, read->rd_fhp, |