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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E2280C61D97 for ; Sun, 29 Jan 2023 16:46:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D44A48573B; Sun, 29 Jan 2023 17:46:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="g7+hks3H"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 24635856DD; Sun, 29 Jan 2023 17:46:31 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B21C185720 for ; Sun, 29 Jan 2023 17:46:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A57B60DDF; Sun, 29 Jan 2023 16:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87355C4339B; Sun, 29 Jan 2023 16:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675010785; bh=gD5Oe9nknAyhghE5bttG5MmATHtmrQVDYxVHThV+/F4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g7+hks3HZzO4kJ2dEQdg+6YsXJy3K7ZwdKsO6EVVdUs1KgiOINSPLvTDh9GWw4Zza La3c5vcMO8gZkG/G9ZCMe2q0YqjlDFizIMwU0SiCtP2WJ2scNC1wngmh/CsYk0zbIH FfCxbjON4R4D6CmCjDg+fVs/zj4JXcxgfrbISRWZUZopyPfca3tjFGG3QTbt63oObW GGu+0LGG046XfXNp8uIcakW54o7h8+X5dkIrQe9cgT8whbAlMQMqlMGjHMzHMSnpC5 Xkm8ErHqBrhevk+6gSJSUnUgeA+mdFV1Zg9S2fKtY7UKJRge89CM+KTlOYGpu3Adn1 aZl9D904+kBlA== Received: by pali.im (Postfix) id 1EED8EFE; Sun, 29 Jan 2023 17:46:23 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type Date: Sun, 29 Jan 2023 17:45:55 +0100 Message-Id: <20230129164555.9940-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230129164555.9940-1-pali@kernel.org> References: <20230129164555.9940-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage. Signed-off-by: Pali Rohár --- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/imagetool.c b/tools/imagetool.c index e1021f44f5ad..87eee4ad04ed 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -49,6 +49,12 @@ int imagetool_verify_print_header( return imagetool_verify_print_header_by_type(ptr, sbuf, tparams, params); for (curr = start; curr != end; curr++) { + /* + * Basically every data file can be guessed / verified as gpimage, + * so skip autodetection of data file as gpimage as it does not work. + */ + if ((*curr)->check_image_type && (*curr)->check_image_type(IH_TYPE_GPIMAGE) == 0) + continue; if ((*curr)->verify_header) { retval = (*curr)->verify_header((unsigned char *)ptr, sbuf->st_size, params); -- 2.20.1