From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97A24C07E9B for ; Wed, 21 Jul 2021 09:40:47 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 155EC60FDA for ; Wed, 21 Jul 2021 09:40:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 155EC60FDA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3D1FA82956; Wed, 21 Jul 2021 11:40:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1626860445; bh=eKeFG/nEu/iHNc9N0HMsQvqrp7aSPT6H6SKgNbQeiXk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DaQ8z+2aMlawvWBFMzNjm6xdKvdy3uIag19AzSGkFK2J3cvQcGqZKOUZ3yA2NAGf1 qY6IdqdJbr7zfGXDdptUUXJCEHsLbHBKgZbqh3vH/Q2cXdnbds20d3oZgi42td3EAT t5/aU5XDWs/MDeZv4ys0JfxYzanaJte+HRynqTDjk6I7bbhdAP0bdF2S5yjGl6Aqhp 9U3wFvFgi1/97Ya6cWGdXmRw0s+64xBv6phu2uDBDi7NBfhg/JveYkDyRDtHKdKWT0 ErbvcVZb0pqWUPFcmoJ009odWqzMIN+IXGM/IKcW5hoFleRmcT87h3d/ovFWPTWrbx dD7LR5LfWLtaw== Received: by phobos.denx.de (Postfix, from userid 109) id 697C282977; Wed, 21 Jul 2021 11:40:43 +0200 (CEST) Received: from mout-u-205.mailbox.org (mout-u-205.mailbox.org [IPv6:2001:67c:2050:1::465:205]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8B2618203D for ; Wed, 21 Jul 2021 11:40:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sr@denx.de Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-205.mailbox.org (Postfix) with ESMTPS id 4GV9Yh2dBWzQkFt; Wed, 21 Jul 2021 11:40:40 +0200 (CEST) Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter06.heinlein-hosting.de (spamfilter06.heinlein-hosting.de [80.241.56.125]) (amavisd-new, port 10030) with ESMTP id TYkmXhctiM8P; Wed, 21 Jul 2021 11:40:37 +0200 (CEST) Subject: Re: [PATCH u-boot-mvebu v2 28/41] tools: kwboot: Fix checking image header version To: =?UTF-8?Q?Marek_Beh=c3=ban?= , u-boot@lists.denx.de, Chris Packham , Baruch Siach , Dirk Eibach , Chris Packham Cc: Dennis Gilmore , Mario Six , Jon Nettleton , =?UTF-8?Q?Pali_Roh=c3=a1r?= References: <20210719122104.29698-1-marek.behun@nic.cz> <20210719122104.29698-29-marek.behun@nic.cz> From: Stefan Roese Message-ID: <7beb08e5-ae3a-976f-3463-c84bb95a07e7@denx.de> Date: Wed, 21 Jul 2021 11:40:36 +0200 MIME-Version: 1.0 In-Reply-To: <20210719122104.29698-29-marek.behun@nic.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5B9FB18BD X-Rspamd-UID: 4b079e X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 19.07.21 14:20, Marek Behún wrote: > From: Pali Rohár > > Function image_version() returns unsigned value, so it can never be > negative. Explicitly check for two supported image versions: v0 and v1. > > Signed-off-by: Pali Rohár > Reviewed-by: Marek Behún Reviewed-by: Stefan Roese Thanks, Stefan > --- > tools/kwboot.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/kwboot.c b/tools/kwboot.c > index 1d32c1b7ad..7feeaa45a2 100644 > --- a/tools/kwboot.c > +++ b/tools/kwboot.c > @@ -634,7 +634,7 @@ kwboot_img_patch_hdr(void *img, size_t size) > } > > image_ver = image_version(img); > - if (image_ver < 0) { > + if (image_ver != 0 && image_ver != 1) { > fprintf(stderr, "Invalid image header version\n"); > errno = EINVAL; > goto out; > Viele Grüße, Stefan -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de