From patchwork Wed May 11 03:33:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro Iwamatsu X-Patchwork-Id: 95069 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 D8718B6F14 for ; Wed, 11 May 2011 13:42:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 333CB28090; Wed, 11 May 2011 05:42:33 +0200 (CEST) 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 ajbfpSeXttRL; Wed, 11 May 2011 05:42:33 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7E3EA28091; Wed, 11 May 2011 05:42:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5133328091 for ; Wed, 11 May 2011 05:42:29 +0200 (CEST) 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 4+BGtSfsISdk for ; Wed, 11 May 2011 05:42:28 +0200 (CEST) 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 mail-pv0-f172.google.com (mail-pv0-f172.google.com [74.125.83.172]) by theia.denx.de (Postfix) with ESMTPS id 07A1628090 for ; Wed, 11 May 2011 05:42:26 +0200 (CEST) Received: by pvh1 with SMTP id 1so71167pvh.3 for ; Tue, 10 May 2011 20:42:24 -0700 (PDT) Received: by 10.68.0.69 with SMTP id 5mr12520642pbc.241.1305085344504; Tue, 10 May 2011 20:42:24 -0700 (PDT) Received: from localhost.localdomain (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id m6sm5229875pbl.85.2011.05.10.20.42.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 May 2011 20:42:23 -0700 (PDT) From: Nobuhiro Iwamatsu To: u-boot@lists.denx.de Date: Wed, 11 May 2011 12:33:08 +0900 Message-Id: <1305084788-19689-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com> X-Mailer: git-send-email 1.7.4.4 MIME-Version: 1.0 Cc: Nobuhiro Iwamatsu Subject: [U-Boot] [PATCH] kwbimage: Fix check variable of checksum X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Nobuhiro Iwamatsu calc_hdrcsum two times are checked. checksumi of exthdr is not checked. Signed-off-by: Nobuhiro Iwamatsu CC: Prafulla Wadaskar --- tools/kwbimage.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kwbimage.c b/tools/kwbimage.c index 964796e..f327b07 100644 --- a/tools/kwbimage.c +++ b/tools/kwbimage.c @@ -356,7 +356,7 @@ static int kwbimage_verify_header (unsigned char *ptr, int image_size, calc_exthdrcsum = kwbimage_checksum8 ((void *)exthdr, sizeof(extbhr_t) - sizeof(uint8_t), 0); - if (calc_hdrcsum != mhdr->checkSum) + if (calc_exthdrcsum != exthdr->checkSum) return -FDT_ERR_BADSTRUCTURE; /* exthdr csum not matched */ return 0;