From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Tue, 14 Jul 2020 14:01:14 -0400 Subject: [Cluster-devel] [PATCH dlm-tool 2/4] dlm_controld: fix may be used uninitialized In-Reply-To: <20200714180116.18642-1-aahringo@redhat.com> References: <20200714180116.18642-1-aahringo@redhat.com> Message-ID: <20200714180116.18642-3-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This patch fixes the following compiler warning: daemon_cpg.c:2158:12: warning: ?run? may be used uninitialized in this function [-Wmaybe-uninitialized] 2158 | run->info.reply_count++; It's fixed by just init the used variable to NULL and use it only if it's not NULL. --- dlm_controld/daemon_cpg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c index 99aca8db..392e0ff6 100644 --- a/dlm_controld/daemon_cpg.c +++ b/dlm_controld/daemon_cpg.c @@ -2115,7 +2115,7 @@ int receive_run_reply(struct dlm_header *hd, int len) int receive_run_request(struct dlm_header *hd, int len) { struct run_request *req = (struct run_request *)hd; - struct run *run; + struct run *run = NULL; run_request_in(req); @@ -2153,7 +2153,7 @@ int receive_run_request(struct dlm_header *hd, int len) return 0; } - if (!opt(enable_helper_ind)) { + if (!opt(enable_helper_ind) && run) { log_debug("receive_run_request %s helper not enabled", req->uuid); run->info.reply_count++; run->info.need_replies--; -- 2.26.2