From 522dcab94ae9938c072cf50062b507cedafdc011 Mon Sep 17 00:00:00 2001 From: Shwetha Acharya Date: Mon, 1 Oct 2018 12:39:48 +0530 Subject: mgmt/glusterd: NULL pointer dereferencing clang fix Problem: dereferencing of this->name; volinfo and xl can be null. Solution: Replaced this->name with apropriate names in few places, added a null check to avoid dereferencing of volinfo, and introduced a goto out statement, such that null pointer value is not passed to the function volgen_xlator_link when xl becomes NULL. Updates: bz#1622665 Change-Id: I77616bd23f58328cb6dbe681914a028991d49abb Signed-off-by: Shwetha Acharya --- xlators/mgmt/glusterd/src/glusterd-volgen.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 3e291e046e3..13b289fdcb8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -3383,12 +3383,12 @@ 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 (!xl) { - ret = -1; - goto out; - } j++; } + if (!xl) { + ret = -1; + goto out; + } ret = volgen_xlator_link(xl, trav); if (ret) -- cgit