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: <20250518130828.968381-1-ant.v.moryakov@gmail.com>
Date: Sun, 18 May 2025 16:08:28 +0300
From: ant.v.moryakov@...il.com
To: mkubecek@...e.cz
Cc: netdev@...r.kernel.org,
	AntonMoryakov <ant.v.moryakov@...il.com>
Subject: [PATCH] common: fix potential NULL dereference in print_rss_hkey()

From: AntonMoryakov <ant.v.moryakov@...il.com>


Static analyzer (Svace) reported a possible null pointer dereference
in print_rss_hkey(). Specifically, when the 'hkey' pointer is NULL,
the function continues execution after printing an error message,
leading to dereferencing hkey[i].

This patch adds an early return after the NULL check to prevent
execution from continuing in such cases.

This resolves:
DEREF_AFTER_NULL: common.c:209

Found by Svace static analysis tool.

Signed-off-by: Anton Moryakov <ant.v.moryakov@...il.com>

---
 common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common.c b/common.c
index 1ba27e7..35ec36d 100644
--- a/common.c
+++ b/common.c
@@ -233,8 +233,10 @@ void print_rss_hkey(u8 *hkey, u32 hkey_size)
 	u32 i;
 
 	printf("RSS hash key:\n");
-	if (!hkey_size || !hkey)
+	if (!hkey_size || !hkey) {
 		printf("Operation not supported\n");
+		return;
+	}
 
 	for (i = 0; i < hkey_size; i++) {
 		if (i == (hkey_size - 1))
-- 
2.34.1


Powered by blists - more mailing lists