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]
Date:   Fri, 29 Nov 2019 16:44:33 -0500
From:   George Spelvin <lkml@....org>
To:     linux-kernel@...r.kernel.org, lkml@....org
Cc:     Michal Hocko <mhocko@...e.com>, Mel Gorman <mgorman@...e.de>
Subject: [RFC PATCH v1 31/50] lib/nodemask.c: Use cheaper prandom_u32_max() in
 node_random()

This function is to spread things around uniformly; cryptographic
unguessability is not required.

Signed-off-by: George Spelvin <lkml@....org>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Mel Gorman <mgorman@...e.de>
---
 lib/nodemask.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/nodemask.c b/lib/nodemask.c
index 3aa454c54c0de..330f9c7d3da97 100644
--- a/lib/nodemask.c
+++ b/lib/nodemask.c
@@ -25,7 +25,7 @@ int node_random(const nodemask_t *maskp)
 	w = nodes_weight(*maskp);
 	if (w)
 		bit = bitmap_ord_to_pos(maskp->bits,
-			get_random_int() % w, MAX_NUMNODES);
+			prandom_u32_max(w), MAX_NUMNODES);
 	return bit;
 }
 #endif
-- 
2.26.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ