Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1450326
| From | Jason Cooper <jason@lakedaemon.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] randomize_range: use random long instead of int |
| Date | 2016-07-26 04:20 +0200 |
| Message-ID | <rZ08p-4x4-1@gated-at.bofh.it> (permalink) |
| References | <rYSNA-7Vk-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi William, Kees, On Mon, Jul 25, 2016 at 11:25:41AM -0700, william.c.roberts@intel.com wrote: > From: William Roberts <william.c.roberts@intel.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@intel.com> > --- > drivers/char/random.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) Upon further review, I think we should dig into this a little bit deeper. Standby, I'll post an RFC series shortly. thx, Jason. > 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 >
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] randomize_range: use random long instead of int william.c.roberts@intel.com - 2016-07-25 20:30 +0200
Re: [PATCH] randomize_range: use random long instead of int Kees Cook <keescook@chromium.org> - 2016-07-25 21:00 +0200
Re: [PATCH] randomize_range: use random long instead of int Jason Cooper <jason@lakedaemon.net> - 2016-07-26 04:20 +0200
[RFC patch 6/6] unicore32: Use simpler API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:10 +0200
[RFC patch 4/6] arm64: Use simpler API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:10 +0200
[RFC patch 3/6] ARM: Use simpler API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:10 +0200
[RFC patch 2/6] x86: Use simpler API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:10 +0200
[RFC patch 5/6] tile: Use simpler API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:10 +0200
[RFC patch 1/6] random: Simplify API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:10 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 05:40 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Kees Cook <keescook@chromium.org> - 2016-07-26 06:50 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 19:10 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Kees Cook <keescook@chromium.org> - 2016-07-26 19:10 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-28 21:10 +0200
RE: [RFC patch 1/6] random: Simplify API for random address requests "Roberts, William C" <william.c.roberts@intel.com> - 2016-07-26 19:40 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Kees Cook <keescook@chromium.org> - 2016-07-26 06:50 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Jason Cooper <jason@lakedaemon.net> - 2016-07-26 18:00 +0200
Re: [RFC patch 1/6] random: Simplify API for random address requests Kees Cook <keescook@chromium.org> - 2016-07-26 18:50 +0200
Re: [kernel-hardening] [RFC patch 1/6] random: Simplify API for random address requests Yann Droneaud <ydroneaud@opteya.com> - 2016-07-27 16:30 +0200
csiph-web