소스 검색

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>
Andreas Fenkart 8 년 전
부모
커밋
490365c38f
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2 3
      tools/env/fw_env.c

+ 2 - 3
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;
 		}
 	}