From patchwork Mon Oct 26 23:40:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1388220 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ElKEgsxA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CKs2m4lc5z9sTr for ; Tue, 27 Oct 2020 10:47:44 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3518E8254A; Tue, 27 Oct 2020 00:42:03 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ElKEgsxA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E341F8250C; Tue, 27 Oct 2020 00:41:08 +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.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1FAEB8249C for ; Tue, 27 Oct 2020 00:40:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id z5so13048160iob.1 for ; Mon, 26 Oct 2020 16:40:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=14UlFepTzZdXe5ZWibinacFngr9otM2lQpLDE2zwXzs=; b=ElKEgsxAqzn0pU+i69W8iJ9byUJpvj9ZKjdQ4sSSzp3tMFQlLbBPsrJ88F+msMn1Ks X4JgvC1LUkkz8PYcJpule7ouvBwu2tZRPKaGiv/ACIh8q1df62VmwCQBT05nchAhA0Ve IUr/E7CFr+lEMBl6QK7rJNbDf1Jqx+LAHIVTQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=14UlFepTzZdXe5ZWibinacFngr9otM2lQpLDE2zwXzs=; b=pGGrWwwX+vgZR4cUjCqm/TRp3em1VWN8mLpL4ywtWUtPKL0wd48TgQqITUCjIvU+jL U0qdhQMXlHwP4ByZVWBesSV5AVdwvOp4P2BS2sI7uVsfLvPAqtcVdbwJXURyCneQzlfT Pd/lNG4iDJ9WNY8g2AQjs4rTSHCGtQwGZC9kBVE4wK3BMl4s2E4xrE1ClC1hEVUoKxNK Miwpx1Cbnwg+IZQsJt4Rz+igWlnfzxHJ0pRzlEFXLmdRNPkgDgilk9kdonRsVtMI8oDt 4lkJ2R1ALKGWEvfXNht10iv0GSf2jMnKEToKxpU5/TO3trv9KeOORXeJG+ua5e3GuPSe oYvA== X-Gm-Message-State: AOAM533NTfqIxloC9ssekC1yl+NZ7nkXk5AnmWCwqOVppHPe62TsfwsP F8P0Xpf7WdQJi2H2IAZn+e5rAZH+POMxUd84 X-Google-Smtp-Source: ABdhPJzO0X9Cgx/YALoJjdQkBW5SISObIqFuwJ3DR7db+kZa3lE8e9wDAgRrPkBMSxHObfandhzaqA== X-Received: by 2002:a5d:9f44:: with SMTP id u4mr8048244iot.141.1603755651489; Mon, 26 Oct 2020 16:40:51 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id e17sm7066857ile.60.2020.10.26.16.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2020 16:40:51 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Simon Glass Subject: [PATCH v2 25/28] binman: Update CheckEntries() for compressed sections Date: Mon, 26 Oct 2020 17:40:23 -0600 Message-Id: <20201026234026.1903778-25-sjg@chromium.org> X-Mailer: git-send-email 2.29.0.rc2.309.g374f81d7ae-goog In-Reply-To: <20201026234026.1903778-1-sjg@chromium.org> References: <20201026234026.1903778-1-sjg@chromium.org> MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean At present this function assumes that the size of a section is at least as large as its contents. With compression this is often not the case. Relax this constraint by using the uncompressed size, if available. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/etype/section.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py index 1618bebe4be..b146239b779 100644 --- a/tools/binman/etype/section.py +++ b/tools/binman/etype/section.py @@ -299,19 +299,21 @@ class Entry_section(Entry): def CheckEntries(self): """Check that entries do not overlap or extend outside the section""" + max_size = self.size if self.uncomp_size is None else self.uncomp_size + offset = 0 prev_name = 'None' for entry in self._entries.values(): entry.CheckEntries() if (entry.offset < self._skip_at_start or entry.offset + entry.size > self._skip_at_start + - self.size): + max_size): entry.Raise('Offset %#x (%d) size %#x (%d) is outside the ' "section '%s' starting at %#x (%d) " 'of size %#x (%d)' % (entry.offset, entry.offset, entry.size, entry.size, self._node.path, self._skip_at_start, - self._skip_at_start, self.size, self.size)) + self._skip_at_start, max_size, max_size)) if entry.offset < offset and entry.size: entry.Raise("Offset %#x (%d) overlaps with previous entry '%s' " "ending at %#x (%d)" %