Skip to content

Commit

Permalink
SUNRPC: Fix the calculation of xdr->end in
Browse files Browse the repository at this point in the history
xdr_get_next_encode_buffer() (git-fixes).

suse-commit: 4718469a0cad3232fb35496a30809687cfe6b5f5
  • Loading branch information
neilbrown committed Jun 21, 2022
1 parent 6ef333d commit bd43188
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/sunrpc/xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,11 @@ static __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
*/
xdr->p = (void *)p + frag2bytes;
space_left = xdr->buf->buflen - xdr->buf->len;
xdr->end = (void *)p + min_t(int, space_left, PAGE_SIZE);
if (space_left - nbytes >= PAGE_SIZE)
xdr->end = (void *)p + PAGE_SIZE;
else
xdr->end = (void *)p + space_left - frag1bytes;

xdr->buf->page_len += frag2bytes;
xdr->buf->len += nbytes;
return p;
Expand Down

0 comments on commit bd43188

Please sign in to comment.