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-next>] [day] [month] [year] [list]
Message-ID: <20240628194350.542376-2-thorsten.blum@toblux.com>
Date: Fri, 28 Jun 2024 21:43:51 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: linux@...linux.org.uk
Cc: mingo@...nel.org,
	sshegde@...ux.ibm.com,
	linux-arm-kernel@...ts.infradead.org,
	linux-kernel@...r.kernel.org,
	Thorsten Blum <thorsten.blum@...lux.com>
Subject: [PATCH] ARM, sched/topology: Check return value of kcalloc()

Check the return value of kcalloc() and return early if memory
allocation fails.

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
---
 arch/arm/kernel/topology.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 2336ee2aa44a..b77d1838e5a3 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -93,6 +93,10 @@ static void __init parse_dt_topology(void)
 
 	__cpu_capacity = kcalloc(nr_cpu_ids, sizeof(*__cpu_capacity),
 				 GFP_NOWAIT);
+	if (unlikely(!__cpu_capacity)) {
+		pr_crit("Failed to allocate memory for __cpu_capacity\n");
+		return;
+	}
 
 	for_each_possible_cpu(cpu) {
 		const __be32 *rate;
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ