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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20430C433F5 for ; Mon, 25 Oct 2021 13:14:16 +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 6C2E760F0F for ; Mon, 25 Oct 2021 13:14:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6C2E760F0F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A020183563; Mon, 25 Oct 2021 15:13:48 +0200 (CEST) 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="tgSVh0f2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D29B883582; Mon, 25 Oct 2021 15:13:26 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 6652683542 for ; Mon, 25 Oct 2021 15:13:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 4649060F9D; Mon, 25 Oct 2021 13:13:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635167593; bh=IULhpqRwT09G9+H3HIIpgJUVRxtyR8PiypxgDIgbpEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tgSVh0f2QXkcBN2ni0j0mFtIZLGErm3adK+oPUJbNHG2VwtbblRvPXO3pEwG5yy8f kmRQ6L1H4jQC8NTNMr7hFYPFbBgQyCjUlqk0/99rrH9Yt8K+nUErYzVOwtTnbyHFjN LnoXezd4yx3hkbtqPjey/sTVCQ64IzH715CTzLqxgbRxv7Sv8mxmk9gcqjnn+ihNdm m44S9ksYpxMpeyiCkxHjfDXQH21gpipNURfDeAiIYwQ9eR8Bfiby0hMJearfv4PFnn kYvafTrIUqy9m25pxwBN3Ymjb1wpXbmg4pM3hkqfn++qTp8Ca3BREKIHyFTSXHtF+q wqROGgd9XkXYA== From: =?UTF-8?q?Marek=20Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 03/13] tools: kwboot: Reserve enough space for patching kwbimage in memory Date: Mon, 25 Oct 2021 15:12:54 +0200 Message-Id: <20211025131304.21310-4-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211025131304.21310-1-kabel@kernel.org> References: <20211025131304.21310-1-kabel@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.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 From: Pali Rohár SPI image header and data parts do not have to be aligned to 128 byte xmodem block size. So reserve additional memory for aligning header part and additional memory for aligning data part. Signed-off-by: Pali Rohár Reviewed-by: Marek Behún --- tools/kwboot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index c55b41025b..4e29317f10 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -1672,8 +1672,10 @@ main(int argc, char **argv) else /* ensure we have enough space for baudrate change code */ after_img_rsv += KWBOOT_BAUDRATE_BIN_HEADER_SZ + + KWBOOT_XM_BLKSZ + sizeof(kwboot_pre_baud_code) + - sizeof(kwboot_baud_code); + sizeof(kwboot_baud_code) + + KWBOOT_XM_BLKSZ; if (imgpath) { img = kwboot_read_image(imgpath, &size, after_img_rsv); -- 2.32.0