]> Pileus Git - ~andy/linux/blobdiff - fs/nfs/nfs2xdr.c
SUNRPC: Refactor logic to NUL-terminate strings in pages
[~andy/linux] / fs / nfs / nfs2xdr.c
index e15bc0306d0cf7f109431fd9490776751df75b67..79c74387a2fe86ddf7f69596785366034325c7c8 100644 (file)
@@ -596,7 +596,6 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy)
        struct kvec *iov = rcvbuf->head;
        size_t hdrlen;
        u32 len, recvd;
-       char    *kaddr;
        int     status;
 
        if ((status = ntohl(*p++)))
@@ -623,10 +622,7 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy)
                return -EIO;
        }
 
-       /* NULL terminate the string we got */
-       kaddr = (char *)kmap_atomic(rcvbuf->pages[0], KM_USER0);
-       kaddr[len+rcvbuf->page_base] = '\0';
-       kunmap_atomic(kaddr, KM_USER0);
+       xdr_terminate_string(rcvbuf, len);
        return 0;
 }