* [U-Boot] [PATCH V2] common: env: initialize scalar variable
@ 2015-12-23 4:07 Peng Fan
2016-01-04 22:23 ` [U-Boot] [U-Boot,V2] " Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Peng Fan @ 2015-12-23 4:07 UTC (permalink / raw)
To: u-boot
From: Peng Fan <peng.fan@nxp.com>
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
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
---
common/env_callback.c | 1 +
common/env_flags.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/common/env_callback.c b/common/env_callback.c
index f4d3dbd..1957cc1 100644
--- a/common/env_callback.c
+++ b/common/env_callback.c
@@ -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? */
diff --git a/common/env_flags.c b/common/env_flags.c
index e682d85..7719355 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -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? */
--
2.6.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [U-Boot,V2] common: env: initialize scalar variable
2015-12-23 4:07 [U-Boot] [PATCH V2] common: env: initialize scalar variable Peng Fan
@ 2016-01-04 22:23 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2016-01-04 22:23 UTC (permalink / raw)
To: u-boot
On Wed, Dec 23, 2015 at 12:07:24PM +0800, Peng Fan wrote:
> From: Peng Fan <peng.fan@nxp.com>
>
> 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
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Simon Glass <sjg@chromium.org>
Applied to u-boot/master, thanks!
--
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-04 22:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 4:07 [U-Boot] [PATCH V2] common: env: initialize scalar variable Peng Fan
2016-01-04 22:23 ` [U-Boot] [U-Boot,V2] " Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox