From 906154bf2e5a65c438cb09fd318ca5f2f301b738 Mon Sep 17 00:00:00 2001 From: nik-redhat Date: Thu, 9 Jul 2020 03:59:48 +0530 Subject: glusterd: dereference of null pointer Issue: 'this' is used before it is defined, therefore it can lead to a NULL dereference. Fix: Moved the definition of 'this', before it's use to avoid NULL dereference. Change-Id: I6ad382192129dfa3a206426e5610040e7a905be6 Updates: #1096 Signed-off-by: nik-redhat --- xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'xlators/mgmt/glusterd/src') diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index 08659a6b35b..cafdffb63c4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -670,6 +670,9 @@ __glusterd_handle_cli_heal_volume(rpcsvc_request_t *req) 0, }; + this = THIS; + GF_ASSERT(this); + GF_ASSERT(req); ret = xdr_to_generic(req->msg[0], &cli_req, (xdrproc_t)xdr_gf_cli_req); @@ -680,9 +683,6 @@ __glusterd_handle_cli_heal_volume(rpcsvc_request_t *req) goto out; } - this = THIS; - GF_ASSERT(this); - if (cli_req.dict.dict_len) { /* Unserialize the dictionary */ dict = dict_new(); -- cgit