Skip to contentSkip to conversation

common: env: initialize scalar variable

PATCH New Peng Fan 2 participants 2 messages Dec 23, 2015 – Jan 4, 2016

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH v2 1/1 common: env: initialize scalar variable

From: Peng Fan <[email protected]>

Before calling hsearch_r, initialize callback entry to NULL.

Coverity log:
"
Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value e. Field e.callback is uninitialized when calling hsearch_r. "

Reported-by Coverity
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>
---
 common/env_callback.c | 1 +
 common/env_flags.c    | 1 +
 2 files changed, 2 insertions(+)
common/env_callback.c +1 -0
index f4d3dbd..1957cc1 100644
@@ -97,6 +97,7 @@ static int set_callback(const char *name, const char *value, void *priv)
 
 	e.key	= name;
 	e.data	= NULL;
+	e.callback = NULL;
 	hsearch_r(e, FIND, &ep, &env_htab, 0);
 
 	/* does the env variable actually exist? */
common/env_flags.c +1 -0
index e682d85..7719355 100644
@@ -455,6 +455,7 @@ static int set_flags(const char *name, const char *value, void *priv)
 
 	e.key	= name;
 	e.data	= NULL;
+	e.callback = NULL;
 	hsearch_r(e, FIND, &ep, &env_htab, 0);
 
 	/* does the env variable actually exist? */
Signature · 1 line
2.6.2
#1 lore raw

PATCH v2 1/1 common: env: initialize scalar variable

Quoted 11 lines · Peng Fan

From: Peng Fan <[email protected]>

Before calling hsearch_r, initialize callback entry to NULL.

Coverity log:
"
Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value e. Field e.callback is uninitialized when calling hsearch_r. "

Quoted 4 lines
Reported-by Coverity
Cc Tom Rini <[email protected]>
Cc Simon Glass <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160104/b8ff99c6/attachment.sig>