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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250918121704.45116-1-qirui.001@bytedance.com>
Date: Thu, 18 Sep 2025 20:17:04 +0800
From: Rui Qi <qirui.001@...edance.com>
To: tony.luck@...el.com,
	bp@...en8.de,
	mchehab@...nel.org,
	james.morse@....com,
	rric@...nel.org
Cc: linux-edac@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Rui Qi <qirui.001@...edance.com>
Subject: [PATCH] EDAC/skx_common: Fix allocation check when adxl_component_count is 0

From: Rui Qi <qirui.001@...edance.com>

Use ZERO_OR_NULL_PTR instead of simple NULL check to properly handle
the case where adxl_component_count is 0, which would result in
kcalloc returning ZERO_SIZE_PTR rather than NULL.

This ensures correct error handling when no ADXL components are
present and prevents potential issues with zero-sized allocations.

Signed-off-by: Rui Qi <qirui.001@...edance.com>
---
 drivers/edac/skx_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/edac/skx_common.c b/drivers/edac/skx_common.c
index 39c733dbc5b9..768d787813ec 100644
--- a/drivers/edac/skx_common.c
+++ b/drivers/edac/skx_common.c
@@ -90,7 +90,7 @@ int skx_adxl_get(void)
 
 	adxl_values = kcalloc(adxl_component_count, sizeof(*adxl_values),
 			      GFP_KERNEL);
-	if (!adxl_values) {
+	if (ZERO_OR_NULL_PTR(adxl_values)) {
 		adxl_component_count = 0;
 		return -ENOMEM;
 	}
-- 
2.20.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ