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: <20250308093452.3742-7-david.laight.linux@gmail.com>
Date: Sat,  8 Mar 2025 09:34:50 +0000
From: David Laight <david.laight.linux@...il.com>
To: linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Cc: David Laight <david.laight.linux@...il.com>,
	Arnd Bergmann <arnd@...db.de>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Christophe Leroy <christophe.leroy@....fr>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Rasmus Villemoes <linux@...musvillemoes.dk>,
	nnac123@...ux.ibm.com,
	horms@...nel.org
Subject: [PATCH next 6/8] test_hexdump: If a test fails print all the parameters

Print the returned lengths as signed integers.
While they shouldn't be negative, -1 is better than 18446744073709551615.
The string outputs were also incorrectly truncated.

Signed-off-by: David Laight <david.laight.linux@...il.com>
---
 lib/test_hexdump.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/test_hexdump.c b/lib/test_hexdump.c
index 07a8cc7e9088..56c0dfbd075b 100644
--- a/lib/test_hexdump.c
+++ b/lib/test_hexdump.c
@@ -146,13 +146,12 @@ static void __init test_hexdump_overflow(size_t buflen, size_t len,
 
 	ok = result == expected && !memcmp(test, buf, TEST_HEXDUMP_BUF_SIZE);
 
-	buf[sizeof(buf) - 1] = '\0';
-
 	if (!ok) {
-		pr_err("Len: %zu buflen: %zu strlen: %zu\n",
+		pr_err("Rowsize %zu, groupsize %zu, ascii %s, len %zu, buflen %zu, strlen %zu\n",
+			rowsize, groupsize, ascii ? "yes" : "no",
 			len, buflen, strnlen(buf, sizeof(buf)));
-		pr_err("Result: %zu '%s'\n", result, buf);
-		pr_err("Expect: %zu '%s'\n", expected, test);
+		pr_err("Result: %zd '%.*s'\n", result, TEST_HEXDUMP_BUF_SIZE, buf);
+		pr_err("Expect: %zd '%.*s'\n", expected, TEST_HEXDUMP_BUF_SIZE, test);
 		failed_tests++;
 	}
 }
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ