All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] NAND: env: remember the flags used in the previous environment
@ 2011-02-08 21:30 Scott Wood
  0 siblings, 0 replies; only message in thread
From: Scott Wood @ 2011-02-08 21:30 UTC (permalink / raw
  To: u-boot

Previously, uninitialized stack space was being referenced.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 common/env_nand.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/common/env_nand.c b/common/env_nand.c
index a4480cb..980425a 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -181,7 +181,10 @@ int writeenv(size_t offset, u_char *buf)
 
 	return 0;
 }
+
 #ifdef CONFIG_ENV_OFFSET_REDUND
+static unsigned char env_flags;
+
 int saveenv(void)
 {
 	env_t	env_new;
@@ -205,7 +208,7 @@ int saveenv(void)
 		return 1;
 	}
 	env_new.crc   = crc32(0, env_new.data, ENV_SIZE);
-	++env_new.flags; /* increase the serial */
+	env_new.flags = ++env_flags; /* increase the serial */
 
 	if(gd->env_valid == 1) {
 		puts("Erasing redundant NAND...\n");
@@ -399,6 +402,7 @@ void env_relocate_spec(void)
 	else
 		ep = tmp_env2;
 
+	env_flags = ep->flags;
 	env_import((char *)ep, 0);
 
 	free(tmp_env1);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-02-08 21:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-08 21:30 [U-Boot] [PATCH] NAND: env: remember the flags used in the previous environment Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.