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>] [day] [month] [year] [list]
Message-ID: <20250926075053.25615-1-chandna.linuxkernel@gmail.com>
Date: Fri, 26 Sep 2025 13:20:53 +0530
From: Sahil Chandna <chandna.linuxkernel@...il.com>
To: akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org
Cc: skhan@...uxfoundation.org,
	david.hunter.linux@...il.com,
	Sahil Chandna <chandna.linuxkernel@...il.com>
Subject: [PATCH] kallsyms: use kmalloc_array() instead of kmalloc()

Replace kmalloc(sizeof(*stat) * 2, GFP_KERNEL) with
kmalloc_array(2, sizeof(*stat), GFP_KERNEL) to prevent potential
overflow, as recommended in Documentation/process/deprecated.rst.

Signed-off-by: Sahil Chandna <chandna.linuxkernel@...il.com>
---
 kernel/kallsyms_selftest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kallsyms_selftest.c b/kernel/kallsyms_selftest.c
index cf4af5728307..2b082a7e24a2 100644
--- a/kernel/kallsyms_selftest.c
+++ b/kernel/kallsyms_selftest.c
@@ -264,7 +264,7 @@ static int test_kallsyms_basic_function(void)
 	char namebuf[KSYM_NAME_LEN];
 	struct test_stat *stat, *stat2;
 
-	stat = kmalloc(sizeof(*stat) * 2, GFP_KERNEL);
+	stat = kmalloc_array(2, sizeof(*stat), GFP_KERNEL);
 	if (!stat)
 		return -ENOMEM;
 	stat2 = stat + 1;
-- 
2.50.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ