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: <20210826012626.1163705-3-isabellabdoamaral@usp.br>
Date:   Wed, 25 Aug 2021 22:26:22 -0300
From:   Isabella Basso <isabellabdoamaral@....br>
To:     linux@...encehorizons.net, geert@...ux-m68k.org
Cc:     ferreiraenzoa@...il.com, augusto.duraes33@...il.com,
        brendanhiggins@...gle.com, dlatypov@...gle.com,
        davidgow@...gle.com, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org, kunit-dev@...glegroups.com,
        ~lkcamp/patches@...ts.sr.ht, rodrigosiqueiramelo@...il.com,
        Isabella Basso <isabellabdoamaral@....br>
Subject: [PATCH 2/6] test_hash.c: move common definitions to top of file

Keep function signatures minimal by making common definitions static.
This does not change any behavior.

Signed-off-by: Isabella Basso <isabellabdoamaral@....br>
---
 lib/test_hash.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lib/test_hash.c b/lib/test_hash.c
index d4b0cfdb0377..8bcc645a7294 100644
--- a/lib/test_hash.c
+++ b/lib/test_hash.c
@@ -23,6 +23,11 @@
 #include <linux/stringhash.h>
 #include <linux/printk.h>
 
+#define SIZE 256 /* Run time is cubic in SIZE */
+
+static u32 string_or; /* stores or-ed string output */
+static u32 hash_or[2][33] = { { 0, } }; /* stores or-ed hash output */
+
 /* 32-bit XORSHIFT generator.  Seed must not be zero. */
 static u32 __init __attribute_const__
 xorshift(u32 seed)
@@ -66,7 +71,7 @@ fill_buf(char *buf, size_t len, u32 seed)
  * recompile and re-test the module without rebooting.
  */
 static bool __init
-test_int_hash(unsigned long long h64, u32 hash_or[2][33])
+test_int_hash(unsigned long long h64)
 {
 	int k;
 	u32 h0 = (u32)h64, h1, h2;
@@ -123,17 +128,15 @@ test_int_hash(unsigned long long h64, u32 hash_or[2][33])
 	return true;
 }
 
-#define SIZE 256	/* Run time is cubic in SIZE */
-
 static int __init
 test_hash_init(void)
 {
 	char buf[SIZE+1];
-	u32 string_or = 0, hash_or[2][33] = { { 0, } };
 	unsigned tests = 0;
 	unsigned long long h64 = 0;
 	int i, j;
 
+	string_or = 0;
 	fill_buf(buf, SIZE, 1);
 
 	/* Test every possible non-empty substring in the buffer. */
@@ -161,7 +164,7 @@ test_hash_init(void)
 
 			string_or |= h0;
 			h64 = h64 << 32 | h0;	/* For use with hash_64 */
-			if (!test_int_hash(h64, hash_or))
+			if (!test_int_hash(h64))
 				return -EINVAL;
 			tests++;
 		} /* i */
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ