From patchwork Thu Nov 14 13:12:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Aubert X-Patchwork-Id: 291215 X-Patchwork-Delegate: wd@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 1FBA62C00BE for ; Fri, 15 Nov 2013 00:25:14 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2058A4A6F5; Thu, 14 Nov 2013 14:25:07 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qGiv+qUzCqcr; Thu, 14 Nov 2013 14:25:06 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3C5E64A6B8; Thu, 14 Nov 2013 14:25:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5EB4E4A6BA for ; Thu, 14 Nov 2013 14:24:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1WHTAvqKh9J4 for ; Thu, 14 Nov 2013 14:24:49 +0100 (CET) X-Greylist: delayed 730 seconds by postgrey-1.27 at theia; Thu, 14 Nov 2013 14:24:42 CET X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from esa2.staubli.c3s2.iphmx.com (esa2.staubli.c3s2.iphmx.com [68.232.139.29]) by theia.denx.de (Postfix) with ESMTPS id 0835B4A6B3 for ; Thu, 14 Nov 2013 14:24:42 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.93,699,1378850400"; d="scan'208";a="6736242" Received: from unknown (HELO fav03not.staubli.pri) ([217.109.88.35]) by esa2.staubli.c3s2.iphmx.com with ESMTP; 14 Nov 2013 14:12:32 +0100 Received: from favd8744.staubli.pri ([10.10.100.28]) by fav03not.staubli.pri (Lotus Domino Release 8.5.1FP5) with ESMTP id 2013111414123186-16261 ; Thu, 14 Nov 2013 14:12:31 +0100 Received: from favd8744.staubli.pri (localhost [127.0.0.1]) by favd8744.staubli.pri (8.14.5/8.14.5) with ESMTP id rAEDCVYb011263; Thu, 14 Nov 2013 14:12:31 +0100 Received: (from aubert@localhost) by favd8744.staubli.pri (8.14.5/8.14.5/Submit) id rAEDCVlM011262; Thu, 14 Nov 2013 14:12:31 +0100 From: Pierre Aubert To: u-boot@lists.denx.de Date: Thu, 14 Nov 2013 14:12:00 +0100 Message-Id: <1384434720-11214-3-git-send-email-p.aubert@staubli.com> X-Mailer: git-send-email 1.7.6.5 In-Reply-To: <1384434720-11214-1-git-send-email-p.aubert@staubli.com> References: <1384434720-11214-1-git-send-email-p.aubert@staubli.com> X-MIMETrack: Itemize by SMTP Server on FAV03NOT/FAVERGES/STAUBLI(Release 8.5.1FP5|September 29, 2010) at 14/11/2013 14:12:31, Serialize by Router on FAV03NOT/FAVERGES/STAUBLI(Release 8.5.1FP5|September 29, 2010) at 14/11/2013 14:12:32, Serialize complete at 14/11/2013 14:12:32 Cc: Pierre Aubert Subject: [U-Boot] [PATCH 2/2] env export fix: compute the CRC on the real lenght of the exported variables. X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@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