From: Pierre Aubert Date: Thu, 14 Nov 2013 14:12:00 +0100 Subject: [U-Boot] [PATCH 2/2] env export fix: compute the CRC on the real lenght of the exported variables. In-Reply-To: <1384434720-11214-1-git-send-email-p.aubert@staubli.com> References: <1384434720-11214-1-git-send-email-p.aubert@staubli.com> Message-ID: <1384434720-11214-3-git-send-email-p.aubert@staubli.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Signed-off-by: Pierre Aubert --- common/cmd_nvedit.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 5bcc324..c32a932 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -922,14 +922,15 @@ NXTARG: ; len = hexport_r(&env_htab, '\0', H_MATCH_KEY | H_MATCH_IDENT, - &res, ENV_SIZE, argc, argv); + &res, size, argc, argv); + if (len < 0) { error("Cannot export environment: errno = %d\n", errno); return 1; } if (chk) { - envp->crc = crc32(0, envp->data, ENV_SIZE); + envp->crc = crc32(0, envp->data, len); #ifdef CONFIG_ENV_ADDR_REDUND envp->flags = ACTIVE_FLAG; #endif -- 1.7.6.5