diff options
author | Andreas Fenkart <andreas.fenkart@digitalstrom.com> | 2016-08-17 21:41:53 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-08-20 18:03:26 (GMT) |
commit | 490365c38f869ecebda701df2c060ba3a9e628d3 (patch) | |
tree | fe39074274fee8059539cb079dbdd0bc08a27ba5 /tools/env/fw_env.c | |
parent | c359ae5e8b461113c51ebbf3e587c4c362bff2e2 (diff) | |
download | u-boot-490365c38f869ecebda701df2c060ba3a9e628d3.tar.xz |
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>
Diffstat (limited to 'tools/env/fw_env.c')
-rw-r--r-- | tools/env/fw_env.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index d2b167d..7cc7488 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1423,10 +1423,9 @@ static int parse_config(struct env_opts *opts) return rc; if (ENVSIZE(0) != ENVSIZE(1)) { - ENVSIZE(0) = ENVSIZE(1) = min(ENVSIZE(0), ENVSIZE(1)); fprintf(stderr, - "Redundant environments have inequal size, set to 0x%08lx\n", - ENVSIZE(1)); + "Redundant environments have unequal size"); + return -1; } } |