From 42d113f59099ecac4335cf9d3d2a6364511350f8 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Sat, 11 Apr 2015 01:03:13 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/10201 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Kaushal M (cherry picked from commit ed9e9c3b1867867a828020b8569c0c7ab1d3be24) Reviewed-on: http://review.gluster.org/10578 --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-volgen.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index eaede5070b4..fec13562216 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -3387,12 +3387,22 @@ volume_volgen_graph_build_clusters_tier (volgen_graph_t *graph, hxl = first_of(graph); - volinfo->type = GF_CLUSTER_TYPE_TIER; + volinfo->type = GF_CLUSTER_TYPE_TIER; + xl = volgen_graph_add_nolink (graph, "cluster/tier", "%s", "tier-dht", 0); + if (!xl) + goto out; + gf_asprintf(&rule, "%s-hot-dht", st_volname); - xlator_set_option(xl, "rule", rule); - xlator_set_option(xl, "xattr-name", "trusted.tier-gfid"); + + ret = xlator_set_option(xl, "rule", rule); + if (ret) + goto out; + + ret = xlator_set_option(xl, "xattr-name", "trusted.tier-gfid"); + if (ret) + goto out; ret = volgen_xlator_link (xl, cxl); ret = volgen_xlator_link (xl, hxl); -- cgit