From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNWPJ-0002mh-IQ for barebox@lists.infradead.org; Wed, 30 Sep 2020 07:20:11 +0000 From: Ahmad Fatoum Date: Wed, 30 Sep 2020 09:19:55 +0200 Message-Id: <20200930072005.1407-2-a.fatoum@pengutronix.de> In-Reply-To: <20200930072005.1407-1-a.fatoum@pengutronix.de> References: <20200930072005.1407-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 02/12] globalvar: fix uninitialized read of variable when no nvvars exist To: barebox@lists.infradead.org Cc: Ahmad Fatoum When there are no nvvars, the function returns an uninitialized ret, return 0 in this case instead. Reported-by: clang-analyzer-10 Signed-off-by: Ahmad Fatoum --- common/globalvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/globalvar.c b/common/globalvar.c index 09479da548f6..904acb94d730 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -674,7 +674,7 @@ int nvvar_save(void) { struct param_d *param; const char *env = default_environment_path_get(); - int ret; + int ret = 0; #define TMPDIR "/.env.tmp" if (!nv_dirty || !env) return 0; -- 2.28.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox