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/libcfs/fail.c | |
parent | 19ae89d32503493315dec77919815d3add851389 (diff) | |
download | op-kernel-dev-bcfa98a50763a0f781a8441d1994ae1456816219.zip op-kernel-dev-bcfa98a50763a0f781a8441d1994ae1456816219.tar.gz |
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/libcfs/fail.c')
-rw-r--r-- | drivers/staging/lustre/lnet/libcfs/fail.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/lustre/lnet/libcfs/fail.c b/drivers/staging/lustre/lnet/libcfs/fail.c index 5d501be..39439b3 100644 --- a/drivers/staging/lustre/lnet/libcfs/fail.c +++ b/drivers/staging/lustre/lnet/libcfs/fail.c @@ -61,7 +61,7 @@ int __cfs_fail_check_set(u32 id, u32 value, int set) /* Fail 1/cfs_fail_val times */ if (cfs_fail_loc & CFS_FAIL_RAND) { - if (cfs_fail_val < 2 || cfs_rand() % cfs_fail_val > 0) + if (cfs_fail_val < 2 || prandom_u32_max(cfs_fail_val) > 0) return 0; } |