summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
diff options
context:
space:
mode:
authorGaurav Kumar Garg <ggarg@redhat.com>2015-04-11 01:03:13 +0530
committerKaushal M <kaushal@redhat.com>2015-05-06 02:02:54 -0700
commit42d113f59099ecac4335cf9d3d2a6364511350f8 (patch)
tree69aae6d4cc503ecc9fb70d572fa63f06825fb7cf /xlators/mgmt/glusterd/src/glusterd-brick-ops.c
parent201c0b95d826d64ccd8889cefd7bfd2cbfc50ab1 (diff)
glusterd: Coverity fix
CID: 1293504 (Calling xlator_set_option without checking return value ) CID: 1293502 (Dereferencing a pointer that might be null xl when calling xlator_set_option) CID: 1293500 (Assigning value from dict_get_int32(dict, "type", &type) to ret here, but that stored value is overwritten before it can be used.) Change-Id: I5314fb399480df70bd77bc374e3b573f2efd5710 BUG: 1093692 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/10201 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Kaushal M <kaushal@redhat.com> (cherry picked from commit ed9e9c3b1867867a828020b8569c0c7ab1d3be24) Reviewed-on: http://review.gluster.org/10578
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-brick-ops.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-brick-ops.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
index 165622f87ef..de358676110 100644
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
@@ -467,6 +467,11 @@ __glusterd_handle_add_brick (rpcsvc_request_t *req)
}
ret = dict_get_int32 (dict, "type", &type);
+ if (ret) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "failed to get type from dictionary");
+ goto out;
+ }
goto brick_val;
}
@@ -547,9 +552,11 @@ brick_val:
if (type != volinfo->type) {
ret = dict_set_int32 (dict, "type", type);
- if (ret)
+ if (ret) {
gf_log (this->name, GF_LOG_ERROR,
"failed to set the new type in dict");
+ goto out;
+ }
}
ret = glusterd_op_begin_synctask (req, GD_OP_ADD_BRICK, dict);