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 85C0AC3DA7A for ; Fri, 6 Jan 2023 15:51:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6AC61853FD; Fri, 6 Jan 2023 16:51:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="rzeNeIJ5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 131C3853E0; Fri, 6 Jan 2023 16:51:49 +0100 (CET) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (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 17577853FD for ; Fri, 6 Jan 2023 16:51:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qt1-x830.google.com with SMTP id j16so2361834qtv.4 for ; Fri, 06 Jan 2023 07:51:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bpnK4ueJGpDCYLWIUbTT5JcQ7M9+Sf4/f+vxRlYzrRs=; b=rzeNeIJ54nTToC0kYXzYBRjBIFPDrj5qVlS0RYFmDmhIwprfIOx+1WQkr0HYGcdCU/ BKeOHfNvtpVwOwC/ZpJFJcJR658s866dMfiJ8XFecADyMDyHVkWWTvd7ipAMfo5rUIi6 htK2/iTta/8IVd4bfu3E+R7jOTrbUGSqKLTa4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bpnK4ueJGpDCYLWIUbTT5JcQ7M9+Sf4/f+vxRlYzrRs=; b=ApY3cFyAevRcX0wY8b9CJWeBqsewadXuSgEPlwl2+quS1IjFhB9VJx7jEhNueqyOqx ZxRcTAy2m3f2saxUgr8rIJUp2yvm3RVLru3ns1Zb5tGL+pLyQyHf2GwZ1D/NiIMqd6lX k9VsEzhwwNUgY01dFPPSYVsH1NMleAP/r62QEmmFmlO9eUOakQE0qNxaQY/f368M4psD K8YN9AW/BERJ0nN4jWUHHPmFKneTX57t47T6iZ/Pg/7zv/vTdpwZjpHea3P5k5+AkY2M K1uz1yrWMFuMMXFOX8zOQgr/YcItccgv+TpeysZNwd/H2+3yMTyWRVll7GPT8O3fO4HK 7UKA== X-Gm-Message-State: AFqh2kpjv8xbL6O2pSpEe6o+WU/nmk3nWW04f7qBsqCE0lxFPBdCFG4D 9Pqzeni6Kb3GsrT8SrjrdHt/r6WK3exrWZLnOE8= X-Google-Smtp-Source: AMrXdXtWHhti8nFPNLLeu+vCElKVusshwuLZJkRVZHr9R8wqpSd/1poTrqGp9m3luG65lAqB5OEhzQ== X-Received: by 2002:ac8:1189:0:b0:3a5:c6ad:7cd7 with SMTP id d9-20020ac81189000000b003a5c6ad7cd7mr75120103qtj.24.1673020304705; Fri, 06 Jan 2023 07:51:44 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-9162-adb5-1773-34c0.res6.spectrum.com. [2603:6081:7b00:6400:9162:adb5:1773:34c0]) by smtp.gmail.com with ESMTPSA id y2-20020a05620a44c200b006f87d28ea3asm696509qkp.54.2023.01.06.07.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jan 2023 07:51:44 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Cc: Marek Vasut , Patrick Delaunay , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH] Revert "common/memsize.c: Fix get_effective_memsize() to check for overflow" Date: Fri, 6 Jan 2023 10:51:43 -0500 Message-Id: <20230106155143.4025812-1-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 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 This reverts commit 777aaaa706bcfe08c284aed06886db7d482af3f8. The changes to this generic function, which is intended to help with 32bit platforms with large amounts of memory has unintended side effects (which in turn lead to boot failures) on other platforms which were previously functional. Reported-by: Marek Vasut Cc: Patrick Delaunay Cc: Pali Rohár Signed-off-by: Tom Rini --- common/memsize.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/common/memsize.c b/common/memsize.c index 3c80ad2c8346..31884acca0df 100644 --- a/common/memsize.c +++ b/common/memsize.c @@ -94,23 +94,11 @@ long get_ram_size(long *base, long maxsize) phys_size_t __weak get_effective_memsize(void) { - phys_size_t ram_size = gd->ram_size; - - /* - * Check for overflow and limit ram size to some representable value. - * It is required that ram_base + ram_size must be representable by - * phys_size_t type and must be aligned by direct access, therefore - * calculate it from last 4kB sector which should work as alignment - * on any platform. - */ - if (gd->ram_base + ram_size < gd->ram_base) - ram_size = ((phys_size_t)~0xfffULL) - gd->ram_base; - #ifndef CONFIG_MAX_MEM_MAPPED - return ram_size; + return gd->ram_size; #else /* limit stack to what we can reasonable map */ - return ((ram_size > CONFIG_MAX_MEM_MAPPED) ? - CONFIG_MAX_MEM_MAPPED : ram_size); + return ((gd->ram_size > CONFIG_MAX_MEM_MAPPED) ? + CONFIG_MAX_MEM_MAPPED : gd->ram_size); #endif } -- 2.25.1