From patchwork Sat Dec 17 09:33:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Horst Kronstorfer X-Patchwork-Id: 131991 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 EBAA91007DB for ; Sat, 17 Dec 2011 20:41:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B9E45283C5; Sat, 17 Dec 2011 10:41:06 +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 PZBxhAK3Kduw; Sat, 17 Dec 2011 10:41:06 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7145328389; Sat, 17 Dec 2011 10:41:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7902F28389 for ; Sat, 17 Dec 2011 10:41:01 +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 uaeseOJoebUa for ; Sat, 17 Dec 2011 10:41:00 +0100 (CET) X-Greylist: delayed 461 seconds by postgrey-1.27 at theia; Sat, 17 Dec 2011 10:40:58 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 m3f4.kronos.net (93-82-138-106.adsl.highway.telekom.at [93.82.138.106]) by theia.denx.de (Postfix) with ESMTPS id 73B3128380 for ; Sat, 17 Dec 2011 10:40:58 +0100 (CET) Received: from m3f4.kronos.net (m3f4.kronos.net [127.0.0.1]) by m3f4.kronos.net (8.14.5/8.14.5) with ESMTP id pBH9XFEf027327; Sat, 17 Dec 2011 10:33:15 +0100 Received: (from mabuze@localhost) by m3f4.kronos.net (8.14.5/8.14.5/Submit) id pBH9XDes027326; Sat, 17 Dec 2011 10:33:13 +0100 From: Horst Kronstorfer To: u-boot@lists.denx.de Date: Sat, 17 Dec 2011 10:33:10 +0100 Message-Id: <1324114390-27290-1-git-send-email-hkronsto@frequentis.com> X-Mailer: git-send-email 1.7.7.4 Subject: [U-Boot] [PATCH] common/cmd_nvedit.c: Fix size calculation in do_env_import() 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 do_env_import() missed the final '\0' terminator when calculating the size of an environment data block. This led to an erroneous 'bad CRC, import failed' message for a checksum protected environment (-c.) Signed-off-by: Horst Kronstorfer --- common/cmd_nvedit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index baaa513..63afc82 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -868,7 +868,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag, printf("## Warning: Input data exceeds %d bytes" " - truncated\n", MAX_ENV_SIZE); } - ++size; + size += 2; printf("## Info: input data size = %zu = 0x%zX\n", size, size); }