]> git.hungrycats.org Git - linux/commitdiff
RPC: xdr_encode_pages either leaves the tail iovec pointing to
authorTrond Myklebust <trond.myklebust@fys.uio.no>
Sat, 7 Feb 2004 15:47:04 +0000 (16:47 +0100)
committerTrond Myklebust <trond.myklebust@fys.uio.no>
Sat, 7 Feb 2004 15:47:04 +0000 (16:47 +0100)
null or, if padding onthe page data is needed, sets it to point
to a little bit of static data. This is a problem if we're
expecting to later append some data in gss_wrap_req. Modify
xdr_encode_pages to make tail point to the end of the data in
head, as xdr_inline_pages and xdr_write_pages do.

net/sunrpc/xdr.c

index 00e0082704ba9b3ed1cf3a8d9081ad0d4010e1af..d64424f30d8f6a7d8ac5e345b37807c0e5aba510 100644 (file)
@@ -107,16 +107,23 @@ void
 xdr_encode_pages(struct xdr_buf *xdr, struct page **pages, unsigned int base,
                 unsigned int len)
 {
+       struct iovec *tail = xdr->tail;
+       u32 *p;
+
        xdr->pages = pages;
        xdr->page_base = base;
        xdr->page_len = len;
 
+       p = (u32 *)xdr->head[0].iov_base + XDR_QUADLEN(xdr->head[0].iov_len);
+       tail->iov_base = p;
+       tail->iov_len = 0;
+
        if (len & 3) {
-               struct iovec *iov = xdr->tail;
                unsigned int pad = 4 - (len & 3);
 
-               iov->iov_base = (void *) "\0\0\0";
-               iov->iov_len  = pad;
+               *p = 0;
+               tail->iov_base = (char *)p + (len & 3);
+               tail->iov_len  = pad;
                len += pad;
        }
        xdr->len += len;