From 4bd4d1ce6e5a062fb48147de65f7f669101e5f4d Mon Sep 17 00:00:00 2001 From: nik-redhat Date: Wed, 9 Sep 2020 12:19:45 +0530 Subject: glusterd: fixing coverity issues In the last patch merge for the performance.readdir -ahead dependencies, there was few issues with return check and NULL derefencing. So, fixed that as per the coverity scanner. CID: 1432493 CID: 1432492 Updates: #1060 Change-Id: I6dee6d35ef41ab8d6322f1b2e3734c4796ee2804 Signed-off-by: nik-redhat --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 00d9338d2e..4e5712e644 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -3359,16 +3359,22 @@ volgen_link_bricks(volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if ((i % sub_count) == 0) { xl = volgen_graph_add_nolink(graph, xl_type, xl_namefmt, volname, j); - if (strncmp(xl_type, "performance/readdir-ahead", - SLEN("performance/readdir-ahead")) == 0) - xlator_set_fixed_option(xl, "performance.readdir-ahead", "on"); j++; } + if (!xl) { ret = -1; goto out; } + if (strncmp(xl_type, "performance/readdir-ahead", + SLEN("performance/readdir-ahead")) == 0) { + ret = xlator_set_fixed_option(xl, "performance.readdir-ahead", + "on"); + if (ret) + goto out; + } + ret = volgen_xlator_link(xl, trav); if (ret) goto out; -- cgit