[U-Boot] [PATCH] cmd: env: Fix CRC calculation for 'env export -c -s'
Neil Stainton
nstainton at asl-control.co.uk
Wed Sep 12 11:02:51 UTC 2018
Fix failure to reimport exported checksummed, size constrained data block.
'env export -c' command ignores optional -s size argument when calculating checksum causing subsequent 'env import -c' to fail.
Signed-off-by: Neil Stainton <nstainton at asl-control.co.uk>
---
cmd/nvedit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index ddc888a..600c38b 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -984,7 +984,8 @@ NXTARG: ;
}
if (chk) {
- envp->crc = crc32(0, envp->data, ENV_SIZE);
+ envp->crc = crc32(0, envp->data,
+ size ? size - offsetof(env_t, data) : ENV_SIZE);
#ifdef CONFIG_ENV_ADDR_REDUND
envp->flags = ACTIVE_FLAG;
#endif
--
2.7.4
More information about the U-Boot
mailing list