Commit ed38c069 authored by J. Bruce Fields's avatar J. Bruce Fields

RPC: remove unneeded checks from xdr_truncate_encode()

Thanks to Andrea Arcangeli for pointing out these checks are
obviously unnecessary given the preceding calculations.
Reported-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent e77a7b4f
...@@ -617,7 +617,7 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len) ...@@ -617,7 +617,7 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len)
fraglen = min_t(int, buf->len - len, tail->iov_len); fraglen = min_t(int, buf->len - len, tail->iov_len);
tail->iov_len -= fraglen; tail->iov_len -= fraglen;
buf->len -= fraglen; buf->len -= fraglen;
if (tail->iov_len && buf->len == len) { if (tail->iov_len) {
xdr->p = tail->iov_base + tail->iov_len; xdr->p = tail->iov_base + tail->iov_len;
/* xdr->end, xdr->iov should be set already */ /* xdr->end, xdr->iov should be set already */
return; return;
...@@ -631,7 +631,7 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len) ...@@ -631,7 +631,7 @@ void xdr_truncate_encode(struct xdr_stream *xdr, size_t len)
old = new + fraglen; old = new + fraglen;
xdr->page_ptr -= (old >> PAGE_SHIFT) - (new >> PAGE_SHIFT); xdr->page_ptr -= (old >> PAGE_SHIFT) - (new >> PAGE_SHIFT);
if (buf->page_len && buf->len == len) { if (buf->page_len) {
xdr->p = page_address(*xdr->page_ptr); xdr->p = page_address(*xdr->page_ptr);
xdr->end = (void *)xdr->p + PAGE_SIZE; xdr->end = (void *)xdr->p + PAGE_SIZE;
xdr->p = (void *)xdr->p + (new % PAGE_SIZE); xdr->p = (void *)xdr->p + (new % PAGE_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment