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 EB2FFC636D7 for ; Tue, 21 Feb 2023 20:26:07 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6977385A8E; Tue, 21 Feb 2023 21:23:16 +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="TsrnO43Z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C80F685B19; Tue, 21 Feb 2023 21:22:45 +0100 (CET) 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 3C04C85A55 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 B2B60B81098; Tue, 21 Feb 2023 20:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E608C4339E; 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=1677010950; bh=Zu9dbCdFn5cJMU7SSqpjTlpVedDuBZK/ldwahWA/N7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TsrnO43Z+taAkFfaax7Y58kDYybG7a1GzEz8BHE+n5zdqp309s7GSj6ysslsMynT0 ZMNJvlAJ3jKuMrAq/5N+zrCbWhmFd5FOZ62XCNGQpL78eSRxFrBQcmfZxZwkxJ8qon 7X3cjCCuEe5SkFZVdgwxBa5BjhH9ImUN7n5JAI0YX2EjJZFGEwzQz2vZ2S5SjamCjr Z9zKlAHnCPkuqWeeAZ2YXnWKEs7u2yjszTe4ECCaBZ5A9pjB6rn3/SfIwey5d/pJgL hjPWuvVuD1AtTeswWt7DmhNrg45NK0VOVTQysmyr1+qCn33X5DjGuixUUPszwmtLfd jANQ5IYJnTXnQ== Received: by pali.im (Postfix) id 1DECBAA6; Tue, 21 Feb 2023 21:22:28 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: u-boot@lists.denx.de Cc: Stefan Roese , Tony Dinh , Josua Mayer Subject: [PATCH RFC u-boot-mvebu 04/59] cmd: mvebu/bubt: Fix parsing SDIO kwbimage Date: Tue, 21 Feb 2023 21:18:30 +0100 Message-Id: <20230221201925.9644-5-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 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 Despite the official specification, Marvell BootROM does not interpret srcaddr from SDIO image as offset in number of sectors (like for SATA image), but as offset in bytes (like for all other images except SATA). To ensure that we do not store invalid SDIO image to the boot location (read by the Marvell BootROM), we need to check that image is valid and srcaddr is intepreted in bytes, in the same way as it is done by Marvell BootROM. This fixes rejecting valid and accepting invalid SDIO images by bubt command. Fixes: 5a0653493307 ("cmd: mvebu/bubt: Check for A38x image data checksum") Signed-off-by: Pali Rohár --- cmd/mvebu/bubt.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 1efbe2e607ca..6bb84da03ed6 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -747,9 +747,6 @@ static int check_image_header(void) offset *= 512; } - if (hdr->blockid == 0xAE) /* SDIO id */ - offset *= 512; - if (offset % 4 != 0 || size < 4 || size % 4 != 0) { printf("Error: Bad A38x image blocksize.\n"); return -ENOEXEC; -- 2.20.1