Skip to content

Commit 6cab60c

Browse files
committed
torture: Stop right-shifting torture_random() return values
Now that torture_random() uses swahw32(), its callers no longer see not-so-random low-order bits, as these are now swapped up into the upper 16 bits of the torture_random() function's return value. This commit therefore removes the right-shifting of torture_random() return values. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 10af436 commit 6cab60c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/torture.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ int torture_hrtimeout_ns(ktime_t baset_ns, u32 fuzzt_ns, struct torture_random_s
9292
ktime_t hto = baset_ns;
9393

9494
if (trsp)
95-
hto += (torture_random(trsp) >> 3) % fuzzt_ns;
95+
hto += torture_random(trsp) % fuzzt_ns;
9696
set_current_state(TASK_IDLE);
9797
return schedule_hrtimeout(&hto, HRTIMER_MODE_REL);
9898
}
@@ -362,7 +362,7 @@ torture_onoff(void *arg)
362362
torture_hrtimeout_jiffies(HZ / 10, &rand);
363363
continue;
364364
}
365-
cpu = (torture_random(&rand) >> 4) % (maxcpu + 1);
365+
cpu = torture_random(&rand) % (maxcpu + 1);
366366
if (!torture_offline(cpu,
367367
&n_offline_attempts, &n_offline_successes,
368368
&sum_offline, &min_offline, &max_offline))

0 commit comments

Comments
 (0)