lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250718094848.587-3-alireza.sanaee@huawei.com>
Date: Fri, 18 Jul 2025 10:48:44 +0100
From: Alireza Sanaee <alireza.sanaee@...wei.com>
To: <devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <jonathan.cameron@...wei.com>, <coresight@...ts.linaro.org>,
	<dianders@...omium.org>, <james.clark@...aro.org>, <krzk@...nel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-perf-users@...r.kernel.org>,
	<linuxarm@...wei.com>, <mark.rutland@....com>, <mike.leach@...aro.org>,
	<robh@...nel.org>, <ruanjinjie@...wei.com>, <saravanak@...gle.com>,
	<shameerali.kolothum.thodi@...wei.com>, <suzuki.poulose@....com>
Subject: [PATCH v3 2/6] arch_topology: drop the use of cpu_node in the pr_info

Remove the use of cpu_node in the pr_info. When of_cpu_node_to_id fails,
it may set a pointer, cpu_node, and the get_cpu_for_node function uses that
pointer to log further in the fail scenario.

Also, change the structure to exit early in fail scenarios which will
help enabling code unification that follows in this series.

Signed-off-by: Alireza Sanaee <alireza.sanaee@...wei.com>
---
 drivers/base/arch_topology.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
index 1037169abb45..6fafd86f608a 100644
--- a/drivers/base/arch_topology.c
+++ b/drivers/base/arch_topology.c
@@ -481,12 +481,13 @@ static int __init get_cpu_for_node(struct device_node *node)
 		return -1;
 
 	cpu = of_cpu_node_to_id(cpu_node);
-	if (cpu >= 0)
-		topology_parse_cpu_capacity(cpu_node, cpu);
-	else
-		pr_info("CPU node for %pOF exist but the possible cpu range is :%*pbl\n",
-			cpu_node, cpumask_pr_args(cpu_possible_mask));
+	if (cpu < 0) {
+		pr_info("CPU node exist but the possible cpu range is :%*pbl\n",
+			cpumask_pr_args(cpu_possible_mask));
+		return cpu;
+	}
 
+	topology_parse_cpu_capacity(cpu_node, cpu);
 	return cpu;
 }
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ