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 59D2DC433F5 for ; Wed, 13 Oct 2021 02:31:01 +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 AE0B960F92 for ; Wed, 13 Oct 2021 02:31:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AE0B960F92 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sholland.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 2722B835C7; Wed, 13 Oct 2021 04:30:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.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=sholland.org header.i=@sholland.org header.b="HHhlbzxs"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="YON0LmAF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5927B832CD; Wed, 13 Oct 2021 04:30:31 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) (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 8A2748355A for ; Wed, 13 Oct 2021 04:30:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id CE3EB5C0197; Tue, 12 Oct 2021 22:30:25 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 12 Oct 2021 22:30:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm3; bh=0/peJdW4fMkRy kz+i7xfutFPedk2CbIqe17+r83Sngs=; b=HHhlbzxsIs3RSN4ohlVYpHOvE9ybz yldMCtrde2O7LqrNzaNdqyt2I0kw3j7eAW6pc5kCsjLFd4tLPs05NFlCESCCpJ2w APxJThR3uhGrse59UkoJ+/OZr39EBz0spxNQ/t8tYqcxP97CWTkZP7O5np795eff 3egFXwLUk2N2iGQYg/7/POoGnzOwU6AKSphto3IMgWZudBcIckIuAO2IhZ5QtJoP qM8CDSz92n6412wf7R6UQY9A5UDjrIQoOwlkJ5kMkbBibj5PYhirLW1YuA6xk6cS lEAdaNMeiCdXgIGp6K9vRiCbZx2W9bMi/Yq5p+7Lgr/994puuIw9/daOg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=0/peJdW4fMkRykz+i7xfutFPedk2CbIqe17+r83Sngs=; b=YON0LmAF D6KvQJjt1A715F+03uEBqJBj3AqqQt7gWdRFiHIvQr4sK8RBJ3adOjTZph6sOWk4 AgxlFR87DAyvvZxqefvNafTCIEoC1n0BQtpHCK4UBY+fTlhNjd/F9wQDrTjCgpNh THGPqOMd2/ZB/R6IHMbpuwzS7yQgOeQDezDfYYqJkLtlo3wFnECFE/f1lSizsIMi uyL3lYUjp1UW1ljbZ3SkE8RQewO1NNhhW724OcK8tT3svG4nm589cugpYNRMRkWm 4HPhIMBR9pdcZZR44NFDkVWnUlNZjni1rQtePjQAWiauodIY1ATsUI1WlvsFr8mp 7LxHvKfpOTCv9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddtledgheeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefurghmuhgv lhcujfholhhlrghnugcuoehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhgqeenucggtf frrghtthgvrhhnpeduhfejfedvhffgfeehtefghfeiiefgfeehgfdvvdevfeegjeehjedv gfejheeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehsrghmuhgvlhesshhhohhllhgrnhgurdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Oct 2021 22:30:25 -0400 (EDT) From: Samuel Holland To: u-boot@lists.denx.de, Jagan Teki , Andre Przywara , Simon Glass Cc: Samuel Holland , Masahiro Yamada Subject: [PATCH 2/3] binman: Prevent entries in a section from overlapping Date: Tue, 12 Oct 2021 21:30:20 -0500 Message-Id: <20211013023022.58829-3-samuel@sholland.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211013023022.58829-1-samuel@sholland.org> References: <20211013023022.58829-1-samuel@sholland.org> MIME-Version: 1.0 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 Currently, if the "offset" property is given for an entry, the section's running offset is completely ignored. This causes entries to overlap if the provided offset is less than the size of the entries earlier in the section. Avoid the overlap by only using the provided offset when it is greater than the running offset. The motivation for this change is the rule used by SPL to find U-Boot on sunxi boards: U-Boot starts 32 KiB after the start of SPL, unless SPL is larger than 32 KiB, in which case U-Boot immediately follows SPL. Signed-off-by: Samuel Holland --- tools/binman/entry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 70222718ea..61822eb5e4 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -404,7 +404,9 @@ class Entry(object): if self.offset_unset: self.Raise('No offset set with offset-unset: should another ' 'entry provide this correct offset?') - self.offset = tools.Align(offset, self.align) + elif self.offset > offset: + offset = self.offset + self.offset = tools.Align(offset, self.align) needed = self.pad_before + self.contents_size + self.pad_after needed = tools.Align(needed, self.align_size) size = self.size -- 2.32.0