diff options
author | NeilBrown <neilb@suse.com> | 2017-12-18 12:41:42 +1100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-01-08 16:03:44 +0100 |
commit | bcfa98a50763a0f781a8441d1994ae1456816219 (patch) | |
tree | 682748195d661e6a8f1f16d52e8cea5e78be3359 /drivers/staging/lustre/lnet/lnet/router.c | |
parent | 19ae89d32503493315dec77919815d3add851389 (diff) | |
download | linux-0-day-bcfa98a50763a0f781a8441d1994ae1456816219.tar.gz linux-0-day-bcfa98a50763a0f781a8441d1994ae1456816219.tar.xz |
staging: lustre: replace cfs_rand() with prandom_u32_max()
All occurrences of
cfs_rand() % X
are replaced with
prandom_u32_max(X)
cfs_rand() is a simple Linear Congruential PRNG. prandom_u32_max()
is at least as random, is seeded with more randomness, and uses
cpu-local state to avoid cross-cpu issues.
This is the first step is discarding the libcfs prng with
the standard linux prng.
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre/lnet/lnet/router.c')
-rw-r--r-- | drivers/staging/lustre/lnet/lnet/router.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 88283ca3f860a..6885d7cd094f5 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -277,8 +277,8 @@ lnet_add_route_to_rnet(struct lnet_remotenet *rnet, struct lnet_route *route) len++; } - /* len+1 positions to add a new entry, also prevents division by 0 */ - offset = cfs_rand() % (len + 1); + /* len+1 positions to add a new entry */ + offset = prandom_u32_max(len + 1); list_for_each(e, &rnet->lrn_routes) { if (!offset) break; |