Commit 2a428b2b authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

SUNRPC: Prevent mixed sign comparisons in rpcrdma_convert_iovs()

Keep the type of the buffer position the same during iovec conversion to
reduce the likelihood of unexpected results from comparisons and length
computations.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Cc: Thomas Talpey <Thomas.Talpey@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c087567d
...@@ -83,7 +83,7 @@ static const char transfertypes[][12] = { ...@@ -83,7 +83,7 @@ static const char transfertypes[][12] = {
*/ */
static int static int
rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, int pos, rpcrdma_convert_iovs(struct xdr_buf *xdrbuf, unsigned int pos,
enum rpcrdma_chunktype type, struct rpcrdma_mr_seg *seg, int nsegs) enum rpcrdma_chunktype type, struct rpcrdma_mr_seg *seg, int nsegs)
{ {
int len, n = 0, p; int len, n = 0, p;
...@@ -169,7 +169,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, ...@@ -169,7 +169,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
struct rpcrdma_req *req = rpcr_to_rdmar(rqst); struct rpcrdma_req *req = rpcr_to_rdmar(rqst);
struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_task->tk_xprt); struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(rqst->rq_task->tk_xprt);
int nsegs, nchunks = 0; int nsegs, nchunks = 0;
int pos; unsigned int pos;
struct rpcrdma_mr_seg *seg = req->rl_segments; struct rpcrdma_mr_seg *seg = req->rl_segments;
struct rpcrdma_read_chunk *cur_rchunk = NULL; struct rpcrdma_read_chunk *cur_rchunk = NULL;
struct rpcrdma_write_array *warray = NULL; struct rpcrdma_write_array *warray = NULL;
...@@ -213,7 +213,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, ...@@ -213,7 +213,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
(__be32 *)&cur_rchunk->rc_target.rs_offset, (__be32 *)&cur_rchunk->rc_target.rs_offset,
seg->mr_base); seg->mr_base);
dprintk("RPC: %s: read chunk " dprintk("RPC: %s: read chunk "
"elem %d@0x%llx:0x%x pos %d (%s)\n", __func__, "elem %d@0x%llx:0x%x pos %u (%s)\n", __func__,
seg->mr_len, (unsigned long long)seg->mr_base, seg->mr_len, (unsigned long long)seg->mr_base,
seg->mr_rkey, pos, n < nsegs ? "more" : "last"); seg->mr_rkey, pos, n < nsegs ? "more" : "last");
cur_rchunk++; cur_rchunk++;
......
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