From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id E65C03846074 for ; Thu, 25 Mar 2021 13:55:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E65C03846074 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0E303ADAA; Thu, 25 Mar 2021 13:55:49 +0000 (UTC) Date: Thu, 25 Mar 2021 14:55:47 +0100 From: Tom de Vries To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org Subject: [committed] Fix uninitialized var in dwz_one_file Message-ID: <20210325135545.GA10035@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Mar 2021 13:55:51 -0000 Hi, The commit dbfecee "Move hardlink handling out of dwz function" added initialization of res->res in dwz_files_1, but failed to do the same in dwz_one_file. Add the missing initialization by factoring out the initialization code from dwz_files_1, and using it in dwz_one_file. Committed to trunk. Thanks, - Tom Fix uninitialized var in dwz_one_file 2021-03-25 Tom de Vries * dwz.c (init_file_result): Factor out of ... (dwz_files_1): ... here. (dwz_one_file): Use init_file_result. --- dwz.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dwz.c b/dwz.c index e132d0e..b865a92 100644 --- a/dwz.c +++ b/dwz.c @@ -16238,6 +16238,14 @@ dwz_with_low_mem (const char *file, const char *outfile, return ret; } +/* Initialize struct file_result RES. */ +static void +init_file_result (struct file_result *res) +{ + res->die_count = 0; + res->res = -3; +} + /* Dwarf-compress FILE. If OUTFILE, write to result to OUTFILE, otherwise modify FILE. */ static int @@ -16248,7 +16256,7 @@ dwz_one_file (const char *file, const char *outfile) if (stats_p) init_stats (file); - res.die_count = 0; + init_file_result (&res); return dwz_with_low_mem (file, outfile, &res, NULL); } @@ -16375,10 +16383,7 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink, int successcount = 0; for (i = 0; i < nr_files; ++i) - { - resa[i].die_count = 0; - resa[i].res = -3; - } + init_file_result (&resa[i]); if (multifile) {