aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorNeil Stainton2018-09-12 11:02:51 +0000
committerTom Rini2018-09-30 13:00:23 -0400
commitd71b029d1d178fb2e1cdb63ae5f45d10f90acca6 (patch)
tree6ca32599493f551396e808e376895241b3ac974a /cmd
parentb592936d357f6c648f59ae0e3159149df3a942fb (diff)
cmd: env: Fix CRC calculation for 'env export -c -s'
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@asl-control.co.uk>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/nvedit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 793b68b8877..de16c72c23f 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -987,7 +987,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