treewide: use get_random_u32_below() instead of deprecated function
This is a simple mechanical transformation done by: @@ expression E; @@ - prandom_u32_max + get_random_u32_below (E) Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Darrick J. Wong <djwong@kernel.org> # for xfs Reviewed-by: SeongJae Park <sj@kernel.org> # for damon Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> # for infiniband Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> # for arm Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # for mmc Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
@@ -399,7 +399,7 @@ static int *get_random_order(int count)
|
||||
order[n] = n;
|
||||
|
||||
for (n = count - 1; n > 1; n--) {
|
||||
r = prandom_u32_max(n + 1);
|
||||
r = get_random_u32_below(n + 1);
|
||||
if (r != n) {
|
||||
tmp = order[n];
|
||||
order[n] = order[r];
|
||||
@@ -538,7 +538,7 @@ static void stress_one_work(struct work_struct *work)
|
||||
{
|
||||
struct stress *stress = container_of(work, typeof(*stress), work);
|
||||
const int nlocks = stress->nlocks;
|
||||
struct ww_mutex *lock = stress->locks + prandom_u32_max(nlocks);
|
||||
struct ww_mutex *lock = stress->locks + get_random_u32_below(nlocks);
|
||||
int err;
|
||||
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user