[PATCH 02/12] globalvar: fix uninitialized read of variable when no nvvars exist

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <a.fatoum@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux