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: <1469471141-25669-1-git-send-email-william.c.roberts@intel.com>
Date:	Mon, 25 Jul 2016 11:25:41 -0700
From:	william.c.roberts@...el.com
To:	linux-mm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:	linux@....linux.org.uk, akpm@...ux-foundation.org,
	keescook@...omium.org, tytso@....edu, arnd@...db.de,
	gregkh@...uxfoundation.org, catalin.marinas@....com,
	will.deacon@....com, ralf@...ux-mips.org, benh@...nel.crashing.org,
	paulus@...ba.org, mpe@...erman.id.au, davem@...emloft.net,
	tglx@...utronix.de, mingo@...hat.com, hpa@...or.com,
	x86@...nel.org, viro@...iv.linux.org.uk, nnk@...gle.com,
	jeffv@...gle.com, salyzyn@...roid.com, dcashman@...roid.com,
	William Roberts <william.c.roberts@...el.com>
Subject: [PATCH] randomize_range: use random long instead of int

From: William Roberts <william.c.roberts@...el.com>

Use a long when generating the random range rather than
an int. This will produce better random distributions as
well as matching all the types at hand.

Signed-off-by: William Roberts <william.c.roberts@...el.com>
---
 drivers/char/random.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index 0158d3b..bbf11b5 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1837,7 +1837,8 @@ randomize_range(unsigned long start, unsigned long end, unsigned long len)
 
 	if (end <= start + len)
 		return 0;
-	return PAGE_ALIGN(get_random_int() % range + start);
+
+	return PAGE_ALIGN(get_random_long() % range + start);
 }
 
 /* Interface for in-kernel drivers of true hardware RNGs.
-- 
1.9.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ