summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2016-06-29 13:53:52 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-07-11 15:50:43 -0400
commita54d4059e5f356c522aabfd38563ab6e64773263 (patch)
tree9a6393703f0b164aea80960d0096cbedf40a255c /net
parent7a89f9c626e337ba6528d8a2829b228c933877fb (diff)
xprtrdma: Chunk list encoders must not return zero
Clean up, based on code audit: Remove the possibility that the chunk list XDR encoders can return zero, which would be interpreted as a NULL. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/xprtrdma/fmr_ops.c2
-rw-r--r--net/sunrpc/xprtrdma/frwr_ops.c2
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c6
3 files changed, 7 insertions, 3 deletions
diff --git a/net/sunrpc/xprtrdma/fmr_ops.c b/net/sunrpc/xprtrdma/fmr_ops.c
index aae4c372a40f..bc5f4a1e3122 100644
--- a/net/sunrpc/xprtrdma/fmr_ops.c
+++ b/net/sunrpc/xprtrdma/fmr_ops.c
@@ -246,6 +246,8 @@ fmr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg,
246 } 246 }
247 mw->mw_nents = i; 247 mw->mw_nents = i;
248 mw->mw_dir = rpcrdma_data_dir(writing); 248 mw->mw_dir = rpcrdma_data_dir(writing);
249 if (i == 0)
250 goto out_dmamap_err;
249 251
250 if (!ib_dma_map_sg(r_xprt->rx_ia.ri_device, 252 if (!ib_dma_map_sg(r_xprt->rx_ia.ri_device,
251 mw->mw_sg, mw->mw_nents, mw->mw_dir)) 253 mw->mw_sg, mw->mw_nents, mw->mw_dir))
diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
index d7613db9185d..f3a06faf0a18 100644
--- a/net/sunrpc/xprtrdma/frwr_ops.c
+++ b/net/sunrpc/xprtrdma/frwr_ops.c
@@ -411,6 +411,8 @@ frwr_op_map(struct rpcrdma_xprt *r_xprt, struct rpcrdma_mr_seg *seg,
411 } 411 }
412 mw->mw_nents = i; 412 mw->mw_nents = i;
413 mw->mw_dir = rpcrdma_data_dir(writing); 413 mw->mw_dir = rpcrdma_data_dir(writing);
414 if (i == 0)
415 goto out_dmamap_err;
414 416
415 dma_nents = ib_dma_map_sg(ia->ri_device, 417 dma_nents = ib_dma_map_sg(ia->ri_device,
416 mw->mw_sg, mw->mw_nents, mw->mw_dir); 418 mw->mw_sg, mw->mw_nents, mw->mw_dir);
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 77e002f4d005..8fde0ab3b695 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -329,7 +329,7 @@ rpcrdma_encode_read_list(struct rpcrdma_xprt *r_xprt,
329 329
330 do { 330 do {
331 n = r_xprt->rx_ia.ri_ops->ro_map(r_xprt, seg, nsegs, false); 331 n = r_xprt->rx_ia.ri_ops->ro_map(r_xprt, seg, nsegs, false);
332 if (n <= 0) 332 if (n < 0)
333 return ERR_PTR(n); 333 return ERR_PTR(n);
334 334
335 *iptr++ = xdr_one; /* item present */ 335 *iptr++ = xdr_one; /* item present */
@@ -397,7 +397,7 @@ rpcrdma_encode_write_list(struct rpcrdma_xprt *r_xprt, struct rpcrdma_req *req,
397 nchunks = 0; 397 nchunks = 0;
398 do { 398 do {
399 n = r_xprt->rx_ia.ri_ops->ro_map(r_xprt, seg, nsegs, true); 399 n = r_xprt->rx_ia.ri_ops->ro_map(r_xprt, seg, nsegs, true);
400 if (n <= 0) 400 if (n < 0)
401 return ERR_PTR(n); 401 return ERR_PTR(n);
402 402
403 iptr = xdr_encode_rdma_segment(iptr, seg); 403 iptr = xdr_encode_rdma_segment(iptr, seg);
@@ -462,7 +462,7 @@ rpcrdma_encode_reply_chunk(struct rpcrdma_xprt *r_xprt,
462 nchunks = 0; 462 nchunks = 0;
463 do { 463 do {
464 n = r_xprt->rx_ia.ri_ops->ro_map(r_xprt, seg, nsegs, true); 464 n = r_xprt->rx_ia.ri_ops->ro_map(r_xprt, seg, nsegs, true);
465 if (n <= 0) 465 if (n < 0)
466 return ERR_PTR(n); 466 return ERR_PTR(n);
467 467
468 iptr = xdr_encode_rdma_segment(iptr, seg); 468 iptr = xdr_encode_rdma_segment(iptr, seg);