mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
NAND: env: remember the flags used in the previous environment
Previously, uninitialized stack space was being referenced. Signed-off-by: Scott Wood <scottwood@freescale.com>
This commit is contained in:
parent
8d4addc3c3
commit
eef1d7199d
1 changed files with 5 additions and 1 deletions
|
@ -181,7 +181,10 @@ int writeenv(size_t offset, u_char *buf)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_ENV_OFFSET_REDUND
|
#ifdef CONFIG_ENV_OFFSET_REDUND
|
||||||
|
static unsigned char env_flags;
|
||||||
|
|
||||||
int saveenv(void)
|
int saveenv(void)
|
||||||
{
|
{
|
||||||
env_t env_new;
|
env_t env_new;
|
||||||
|
@ -205,7 +208,7 @@ int saveenv(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
env_new.crc = crc32(0, env_new.data, ENV_SIZE);
|
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) {
|
if(gd->env_valid == 1) {
|
||||||
puts("Erasing redundant NAND...\n");
|
puts("Erasing redundant NAND...\n");
|
||||||
|
@ -399,6 +402,7 @@ void env_relocate_spec(void)
|
||||||
else
|
else
|
||||||
ep = tmp_env2;
|
ep = tmp_env2;
|
||||||
|
|
||||||
|
env_flags = ep->flags;
|
||||||
env_import((char *)ep, 0);
|
env_import((char *)ep, 0);
|
||||||
|
|
||||||
free(tmp_env1);
|
free(tmp_env1);
|
||||||
|
|
Loading…
Reference in a new issue