summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2016-01-14 17:14:00 +0800
committerguoyin.chen <guoyin.chen@freescale.com>2016-03-04 15:35:54 +0800
commit18f44905a030a4c16e5740da3e74160e5966e101 (patch)
tree94845484c2af0a1b9ec29c7799044f9cf3c98be9 /common
parent1dc5e6a42f83d52d314e79c7d46ace9d848c1dc8 (diff)
downloadu-boot-imx-18f44905a030a4c16e5740da3e74160e5966e101.zip
u-boot-imx-18f44905a030a4c16e5740da3e74160e5966e101.tar.gz
u-boot-imx-18f44905a030a4c16e5740da3e74160e5966e101.tar.bz2
MLK-12199 common:env fix unintialized scalar value
Reported by coverity ID: 17900 17902 Using uninitialized value e. Field e.flags is uninitialized when calling hsearch_r Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_nvedit.c10
-rw-r--r--common/env_callback.c1
-rw-r--r--common/env_flags.c1
3 files changed, 11 insertions, 1 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index c4194d5..6ff041b 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -5,7 +5,7 @@
* (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
* Andreas Heppel <aheppel@sysgo.de>
*
- * Copyright 2011-2014 Freescale Semiconductor, Inc.
+ * Copyright (C) 2011-2016 Freescale Semiconductor, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -90,6 +90,8 @@ static int env_print(char *name, int flag)
e.key = name;
e.data = NULL;
+ e.callback = NULL;
+ e.flags = 0;
hsearch_r(e, FIND, &ep, &env_htab, flag);
if (ep == NULL)
return 0;
@@ -271,6 +273,8 @@ static int _do_env_set(int flag, int argc, char * const argv[])
e.key = name;
e.data = value;
+ e.callback = NULL;
+ e.flags = 0;
hsearch_r(e, ENTER, &ep, &env_htab, env_flag);
free(value);
if (!ep) {
@@ -615,6 +619,8 @@ char *getenv(const char *name)
e.key = name;
e.data = NULL;
+ e.callback = NULL;
+ e.flags = 0;
hsearch_r(e, FIND, &ep, &env_htab, 0);
return ep ? ep->data : NULL;
@@ -1089,6 +1095,8 @@ static int do_env_exists(cmd_tbl_t *cmdtp, int flag, int argc,
e.key = argv[1];
e.data = NULL;
+ e.callback = NULL;
+ e.flags = 0;
hsearch_r(e, FIND, &ep, &env_htab, 0);
return (ep == NULL) ? 1 : 0;
diff --git a/common/env_callback.c b/common/env_callback.c
index 7de88fb..c7f002a 100644
--- a/common/env_callback.c
+++ b/common/env_callback.c
@@ -98,6 +98,7 @@ static int set_callback(const char *name, const char *value)
e.key = name;
e.data = NULL;
e.callback = NULL;
+ e.flags = 0;
hsearch_r(e, FIND, &ep, &env_htab, 0);
/* does the env variable actually exist? */
diff --git a/common/env_flags.c b/common/env_flags.c
index 815aff9..471973a 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -442,6 +442,7 @@ static int set_flags(const char *name, const char *value)
e.key = name;
e.data = NULL;
e.callback = NULL;
+ e.flags = 0;
hsearch_r(e, FIND, &ep, &env_htab, 0);
/* does the env variable actually exist? */