Message ID | 20250213131104.186663-3-sughosh.ganu@linaro.org |
---|---|
State | New |
Headers | show
Delivered-To: patch@linaro.org Received: by 2002:a5d:47a6:0:b0:38f:210b:807b with SMTP id 6csp416023wrb; Thu, 13 Feb 2025 05:11:52 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWliyrcUsGAsXzyKP+37RVqOS3ddYRGpdy1hahtW8afCOJBVb8ynS5pyzN3SqeDTXk0Az23vQ==@linaro.org X-Google-Smtp-Source: AGHT+IHRWAZc+TuTmS0eAe/YfppOpXTFJUMSvn4lYSPmGpCdqbZ/uT1gVLGlPojVIrZORwtk4wi2 X-Received: by 2002:a05:600c:3151:b0:431:5c3d:1700 with SMTP id 5b1f17b1804b1-439601b85f4mr34598365e9.21.1739452312058; Thu, 13 Feb 2025 05:11:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739452311; cv=none; d=google.com; s=arc-20240605; b=Svut5mABoNjOSrxMLIIGwh9pJ4+aZ2LbSU8gdYr38PzbDy85agty//I/Jvk9EYKZz4 28/EuKUCksctsY7XTBcvywrMrsk+NKKNbKqebM4DsnyjnA/72bgn8iistCPNJfN04mYd h/GotBAesyyLjv4P5/tZ5RbMqxl3N2IdtvpZBPv0kTd6HMmcA4HcjGQOMpnkIlxaMBoO 6OTQUCyY/n6+ZmI8m0kXEzL/w21bwvPaFYrPt1l/OSrYvhnJf4A9pqSkm6o74carrZYm lc5aoUqAKDkBipHxU8io5tg+DZ7CzskovFGAPnw+pXG2BOWQThYUKhHWTKcKXLVqyygX 805Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=olkOoiczJGdsIm6UjoBQpcZaKp25YwNQ9zP3RoPDANg=; fh=2HGKihHUAicyV3F+aHiaoPpwvqWA0zlC04Ew6QaQoEg=; b=dgfFXwtsdYOeTRXwqZtGjPtjpvoDFFfvXfewptm8prg/yeookisA0NLXR5YfkWjK0l DtuzFeJyWXbPBjKXSf+Ee34wGH+wIJ7sckZL8pfqPglFOyHbda9FI1VP68yPef9E88MF AIMGFCoCzioAJNS+NeV36O34mA3+aU01GepljZFftlk/zvboHNIr3B00Lq+Pnb2UzS1p JUOXRy+Q0HijWfJrxP/OBc9gjaDGmL3cu6Xsl7MvxUeegD72sc9kn1LqQcRSfhs+t6s8 wGhYJAR1PvaR+oOAlk+goGbLR1nbde5a96Snby+bf0UPA8V6YhHnCy8Z2CQ4yyb2UMco OIVQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: <u-boot-bounces@lists.denx.de> Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 5b1f17b1804b1-439617e9c59si13869915e9.41.2025.02.13.05.11.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2025 05:11:51 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DEEDF80F1A; Thu, 13 Feb 2025 14:11:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 314C080F03; Thu, 13 Feb 2025 14:11:41 +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=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 14937806FE for <u-boot@lists.denx.de>; Thu, 13 Feb 2025 14:11:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 386AD16F3; Thu, 13 Feb 2025 05:11:59 -0800 (PST) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB3793F58B; Thu, 13 Feb 2025 05:11:35 -0800 (PST) From: Sughosh Ganu <sughosh.ganu@linaro.org> To: u-boot@lists.denx.de Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org>, Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>, Quentin Schulz <quentin.schulz@cherry.de>, Udit Kumar <u-kumar1@ti.com>, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>, Sughosh Ganu <sughosh.ganu@linaro.org> Subject: [PATCH 2/4] lmb: handle scenario of of encompassing overlap Date: Thu, 13 Feb 2025 18:41:02 +0530 Message-Id: <20250213131104.186663-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250213131104.186663-1-sughosh.ganu@linaro.org> References: <20250213131104.186663-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean |
Series | lmb: miscellaneous fixes and improvements | expand |
diff --git a/lib/lmb.c b/lib/lmb.c index aeaf120f57d..a5216bdccc7 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -111,11 +111,9 @@ static void lmb_fix_over_lap_regions(struct alist *lmb_rgn_lst, phys_addr_t base2 = rgn[r2].base; phys_size_t size2 = rgn[r2].size; - if (base1 + size1 > base2 + size2) { - printf("This will not be a case any time\n"); - return; - } - rgn[r1].size = base2 + size2 - base1; + if (base1 + size1 < base2 + size2) + rgn[r1].size = base2 + size2 - base1; + lmb_remove_region(lmb_rgn_lst, r2); }
The lmb_fix_over_lap_regions() function is called if the added region overlaps with an existing region. The function then fixes the overlap and removes the redundant region. However, it makes an assumption that the overlap would not encompass the existing region, and in such a scenario, it prints a message and returns without making the fix. Handle the case of an encompassing overlap also in the function. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reported-by: Quentin Schulz <quentin.schulz@cherry.de> --- Note: To be applied after an A-b/R-b/T-b from the original author of the lmb_fix_over_lap_regions() function on this lib/lmb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)