diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-09-21 16:55:48 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-09-21 16:55:48 -0400 |
commit | b4687da7fc5f741af7fee9b0248a2cf2ad9c4478 (patch) | |
tree | 1df8cb2cc72a88b4646bf380ff68345415d0222f /fs/nfs/nfs4xdr.c | |
parent | 38359352fcb0d776b562a9e0ed4f0d355d5a332e (diff) |
SUNRPC: Refactor logic to NUL-terminate strings in pages
Clean up: Introduce a helper to '\0'-terminate XDR strings
that are placed in a page in the page cache.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index b0bd7efe8100..86ab69eb149c 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4299,7 +4299,6 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req) | |||
4299 | size_t hdrlen; | 4299 | size_t hdrlen; |
4300 | u32 len, recvd; | 4300 | u32 len, recvd; |
4301 | __be32 *p; | 4301 | __be32 *p; |
4302 | char *kaddr; | ||
4303 | int status; | 4302 | int status; |
4304 | 4303 | ||
4305 | status = decode_op_hdr(xdr, OP_READLINK); | 4304 | status = decode_op_hdr(xdr, OP_READLINK); |
@@ -4330,9 +4329,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req) | |||
4330 | * and and null-terminate the text (the VFS expects | 4329 | * and and null-terminate the text (the VFS expects |
4331 | * null-termination). | 4330 | * null-termination). |
4332 | */ | 4331 | */ |
4333 | kaddr = (char *)kmap_atomic(rcvbuf->pages[0], KM_USER0); | 4332 | xdr_terminate_string(rcvbuf, len); |
4334 | kaddr[len+rcvbuf->page_base] = '\0'; | ||
4335 | kunmap_atomic(kaddr, KM_USER0); | ||
4336 | return 0; | 4333 | return 0; |
4337 | out_overflow: | 4334 | out_overflow: |
4338 | print_overflow_msg(__func__, xdr); | 4335 | print_overflow_msg(__func__, xdr); |