Skip to content

Commit 48a124e

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Fix use of xdr_stream_encode_item_{present, absent}
These new helpers do not return 0 on success, they return the encoded size. Thus they are not a drop-in replacement for the old helpers. Fixes: 5c266df ("SUNRPC: Add encoders for list item discriminators") Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent bdb2ce8 commit 48a124e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

net/sunrpc/xprtrdma/rpc_rdma.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,9 @@ static int rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt,
388388
} while (nsegs);
389389

390390
done:
391-
return xdr_stream_encode_item_absent(xdr);
391+
if (xdr_stream_encode_item_absent(xdr) < 0)
392+
return -EMSGSIZE;
393+
return 0;
392394
}
393395

394396
/* Register and XDR encode the Write list. Supports encoding a list
@@ -454,7 +456,9 @@ static int rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt,
454456
*segcount = cpu_to_be32(nchunks);
455457

456458
done:
457-
return xdr_stream_encode_item_absent(xdr);
459+
if (xdr_stream_encode_item_absent(xdr) < 0)
460+
return -EMSGSIZE;
461+
return 0;
458462
}
459463

460464
/* Register and XDR encode the Reply chunk. Supports encoding an array
@@ -480,8 +484,11 @@ static int rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt,
480484
int nsegs, nchunks;
481485
__be32 *segcount;
482486

483-
if (wtype != rpcrdma_replych)
484-
return xdr_stream_encode_item_absent(xdr);
487+
if (wtype != rpcrdma_replych) {
488+
if (xdr_stream_encode_item_absent(xdr) < 0)
489+
return -EMSGSIZE;
490+
return 0;
491+
}
485492

486493
seg = req->rl_segments;
487494
nsegs = rpcrdma_convert_iovs(r_xprt, &rqst->rq_rcv_buf, 0, wtype, seg);

0 commit comments

Comments
 (0)