From c5f5ce2a9b1c085209cae21a7e1df5f60bc1a7da Mon Sep 17 00:00:00 2001 From: Bhumika Goyal Date: Thu, 18 Oct 2018 14:15:40 +0530 Subject: rdma: coverity fixes Fixes CID: 1382442 1382415 1382379 1382355 Change-Id: Ia712e37cb5a6db452d3178386394f87f83b85d38 updates: bz#789278 Signed-off-by: Bhumika Goyal --- rpc/rpc-transport/rdma/src/rdma.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'rpc/rpc-transport/rdma/src/rdma.c') diff --git a/rpc/rpc-transport/rdma/src/rdma.c b/rpc/rpc-transport/rdma/src/rdma.c index d5d93d13481..26cf201a8a3 100644 --- a/rpc/rpc-transport/rdma/src/rdma.c +++ b/rpc/rpc-transport/rdma/src/rdma.c @@ -3032,7 +3032,7 @@ gf_rdma_unregister_peer(gf_rdma_device_t *device, int32_t qp_num) ent = qpreg->ents[hash].next; while ((ent != &qpreg->ents[hash]) && (ent->qp_num != qp_num)) ent = ent->next; - if (ent->qp_num != qp_num) { + if ((ent->qp_num != qp_num) || (ent == &qpreg->ents[hash])) { pthread_mutex_unlock(&qpreg->lock); return; } @@ -3311,9 +3311,6 @@ gf_rdma_decode_error_msg(gf_rdma_peer_t *peer, gf_rdma_post_t *post, goto out; } - iobref_add(iobref, iobuf); - iobuf_unref(iobuf); - ret = rpc_reply_to_xdr(&rpc_msg, iobuf_ptr(iobuf), iobuf_pagesize(iobuf), &post->ctx.vector[0]); if (ret == -1) { @@ -3324,6 +3321,9 @@ gf_rdma_decode_error_msg(gf_rdma_peer_t *peer, gf_rdma_post_t *post, goto out; } + iobref_add(iobref, iobuf); + iobuf_unref(iobuf); + post->ctx.count = 1; iobuf = NULL; @@ -3445,7 +3445,8 @@ out: GF_FREE(*readch); *readch = NULL; } - + if (reply_info) + GF_FREE(reply_info); GF_FREE(write_ary); } @@ -3553,10 +3554,10 @@ gf_rdma_do_reads(gf_rdma_peer_t *peer, gf_rdma_post_t *post, } } + ptr = iobuf_ptr(iobuf); iobref_add(post->ctx.iobref, iobuf); iobuf_unref(iobuf); - ptr = iobuf_ptr(iobuf); iobuf = NULL; pthread_mutex_lock(&priv->write_mutex); -- cgit