From patchwork Tue Feb 21 20:18:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1745879 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=jRdAgS4n; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PLrPd5ChSz23yr for ; Wed, 22 Feb 2023 07:25:09 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B106E859FF; Tue, 21 Feb 2023 21:22:55 +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="jRdAgS4n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F2EC85B0F; Tue, 21 Feb 2023 21:22:45 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (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 9993385A83 for ; Tue, 21 Feb 2023 21:22:32 +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 ams.source.kernel.org (Postfix) with ESMTPS id 40B31B810C2; Tue, 21 Feb 2023 20:22:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C92FBC433A1; Tue, 21 Feb 2023 20:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677010951; bh=7f7S0Z4TcM3BxBtRNgKCRVjyqbAHMMiD1H4Mhh6E0/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jRdAgS4nPUN3X8js9LfNYdhJR/dTg/E0vgBBw1O1qA1ALgaH/M75xUZvlPzib41FD /Iom3Kp1pPMEbSdHsOvV08GUzZpSmYqhaIb4ELk8H/jBqKEHvakLARhRXoAiCffrid HuzIY6ADu7zg02q7jGVtYwVkzsqt+AXsp3Ia4f8iE1mRymyU4/dgtT+F4uYF1f64Il 2fYCaFL9EsWZWp43FLrt9X2bPYJ+Ol4bGrh0fVjL1dN3MiS1q10wcL4XPMf3ElpHKE RO/Wwy3Tnhk/YlMf8HHZDR1tkTCBS+oC3eYcjnQL94kv3FoA4TtNKUC/Pe/R34ad1q aCwCMlIXGIUGQ== Received: by pali.im (Postfix) id D86F0AFB; Tue, 21 Feb 2023 21:22:28 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: u-boot@lists.denx.de Cc: Stefan Roese , Tony Dinh , Josua Mayer Subject: [PATCH RFC u-boot-mvebu 08/59] cmd: mvebu/bubt: Fix parsing SATA kwbimage Date: Tue, 21 Feb 2023 21:18:34 +0100 Message-Id: <20230221201925.9644-9-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230221201925.9644-1-pali@kernel.org> References: <20230221201925.9644-1-pali@kernel.org> MIME-Version: 1.0 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 Despite the official specification, Marvell BootROM does not interpret srcaddr from SATA image as number of sectors the beginning of the hard drive, but as number of sectors relative to the main header. Reject invalid and accept valid SATA images. Fixes: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum") Signed-off-by: Pali Rohár --- cmd/mvebu/bubt.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 6bb84da03ed6..2bcdf145f64a 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -738,14 +738,8 @@ static int check_image_header(void) offset = le32_to_cpu(hdr->srcaddr); size = le32_to_cpu(hdr->blocksize); - if (hdr->blockid == 0x78) { /* SATA id */ - if (offset < 1) { - printf("Error: Bad A38x image srcaddr.\n"); - return -ENOEXEC; - } - offset -= 1; + if (hdr->blockid == 0x78) /* SATA id */ offset *= 512; - } if (offset % 4 != 0 || size < 4 || size % 4 != 0) { printf("Error: Bad A38x image blocksize.\n");