Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82416
b: refs/heads/master
c: ca2a05a
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields committed Feb 1, 2008
1 parent 55b2f41 commit 16b20ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a490c681cbcf65d548138c377bb691c85824d323
refs/heads/master: ca2a05aa7c72309ee65164c78fa2be7a5038215e
9 changes: 7 additions & 2 deletions trunk/fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,12 @@ xdr_error: \
} \
} while (0)

static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
{
/* We want more bytes than seem to be available.
* Maybe we need a new page, maybe we have just run out
*/
int avail = (char*)argp->end - (char*)argp->p;
unsigned int avail = (char *)argp->end - (char *)argp->p;
__be32 *p;
if (avail + argp->pagelen < nbytes)
return NULL;
Expand All @@ -169,6 +169,11 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes)
return NULL;

}
/*
* The following memcpy is safe because read_buf is always
* called with nbytes > avail, and the two cases above both
* guarantee p points to at least nbytes bytes.
*/
memcpy(p, argp->p, avail);
/* step to next page */
argp->p = page_address(argp->pagelist[0]);
Expand Down

0 comments on commit 16b20ca

Please sign in to comment.