mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
tools/env: return with error if redundant environments have unequal size
For double buffering to work, the target buffer must always be big enough to hold all data. This can only be ensured if buffers are of equal size, otherwise one must be smaller and we risk data loss when copying from the bigger to the smaller buffer. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com> Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
parent
c359ae5e8b
commit
490365c38f
1 changed files with 2 additions and 3 deletions
5
tools/env/fw_env.c
vendored
5
tools/env/fw_env.c
vendored
|
@ -1423,10 +1423,9 @@ static int parse_config(struct env_opts *opts)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
if (ENVSIZE(0) != ENVSIZE(1)) {
|
if (ENVSIZE(0) != ENVSIZE(1)) {
|
||||||
ENVSIZE(0) = ENVSIZE(1) = min(ENVSIZE(0), ENVSIZE(1));
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Redundant environments have inequal size, set to 0x%08lx\n",
|
"Redundant environments have unequal size");
|
||||||
ENVSIZE(1));
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue