Skip to content
Snippets Groups Projects
Commit 3b250ffb authored by Daniel Hobi's avatar Daniel Hobi Committed by Scott Wood
Browse files

env_nand: zero-initialize variable nand_erase_options


Commit 30486322 (nand erase: .spread, .part, .chip subcommands)
added a new field to struct nand_erase_options, but forgot to
update common/env_nand.c.

Depending on the stack state and bad block distribution, saveenv()
can thus erase more than CONFIG_ENV_RANGE bytes which may corrupt
the following NAND sectors/partitions.

Signed-off-by: default avatarDaniel Hobi <daniel.hobi@schmid-telecom.ch>
Signed-off-by: default avatarScott Wood <scottwood@freescale.com>
parent 5d1ee00b
No related branches found
No related tags found
No related merge requests found
......@@ -193,10 +193,8 @@ int saveenv(void)
int ret = 0;
nand_erase_options_t nand_erase_options;
memset(&nand_erase_options, 0, sizeof(nand_erase_options));
nand_erase_options.length = CONFIG_ENV_RANGE;
nand_erase_options.quiet = 0;
nand_erase_options.jffs2 = 0;
nand_erase_options.scrub = 0;
if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
return 1;
......@@ -249,10 +247,8 @@ int saveenv(void)
char *res;
nand_erase_options_t nand_erase_options;
memset(&nand_erase_options, 0, sizeof(nand_erase_options));
nand_erase_options.length = CONFIG_ENV_RANGE;
nand_erase_options.quiet = 0;
nand_erase_options.jffs2 = 0;
nand_erase_options.scrub = 0;
nand_erase_options.offset = CONFIG_ENV_OFFSET;
if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment