From: Andreas Fenkart Date: Wed, 17 Aug 2016 21:41:53 +0000 (+0200) Subject: tools/env: return with error if redundant environments have unequal size X-Git-Tag: v2016.09-rc2~7 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=490365c38f869ecebda701df2c060ba3a9e628d3;p=u-boot 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 Signed-off-by: Andreas Fenkart Reviewed-by: Tom Rini --- diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index d2b167deb9..7cc7488060 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; } }