SUNRPC: Fix setting of buffer length in xdr_set_next_buffer()
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 20 Sep 2016 18:33:43 +0000 (14:33 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Thu, 22 Sep 2016 21:17:47 +0000 (17:17 -0400)
Use xdr->nwords to tell us how much buffer remains.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xdr.c

index b8444860edf50e6a00fb95fcaf969bd03aae172a..7f1071e103cafd7e4fadd75969cad8d5235fa927 100644 (file)
@@ -767,7 +767,7 @@ static void xdr_set_next_page(struct xdr_stream *xdr)
        newbase -= xdr->buf->page_base;
 
        if (xdr_set_page_base(xdr, newbase, PAGE_SIZE) < 0)
-               xdr_set_iov(xdr, xdr->buf->tail, xdr->buf->len);
+               xdr_set_iov(xdr, xdr->buf->tail, xdr->nwords << 2);
 }
 
 static bool xdr_set_next_buffer(struct xdr_stream *xdr)
@@ -776,7 +776,7 @@ static bool xdr_set_next_buffer(struct xdr_stream *xdr)
                xdr_set_next_page(xdr);
        else if (xdr->iov == xdr->buf->head) {
                if (xdr_set_page_base(xdr, 0, PAGE_SIZE) < 0)
-                       xdr_set_iov(xdr, xdr->buf->tail, xdr->buf->len);
+                       xdr_set_iov(xdr, xdr->buf->tail, xdr->nwords << 2);
        }
        return xdr->p != xdr->end;
 }