summaryrefslogtreecommitdiff
path: root/cmd/nvedit.c
diff options
context:
space:
mode:
authorNeil Stainton <nstainton@asl-control.co.uk>2018-09-12 11:02:51 +0000
committerTom Rini <trini@konsulko.com>2018-09-30 13:00:23 -0400
commitd71b029d1d178fb2e1cdb63ae5f45d10f90acca6 (patch)
tree6ca32599493f551396e808e376895241b3ac974a /cmd/nvedit.c
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/nvedit.c')
-rw-r--r--cmd/nvedit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 793b68b887..de16c72c23 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