Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

torture: Avoid modulo-zero error in torture_hrtimeout_ns()

Currently, all calls to torture_hrtimeout_ns() either provide a non-zero
fuzzt_ns or a NULL trsp, either of which avoids taking the modulus of a
zero-valued fuzzt_ns. But this code should do a better job of defending
itself, so this commit explicitly checks fuzzt_ns and avoids the modulus
when its value is zero.

Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com>

authored by

Paul E. McKenney and committed by
Joel Fernandes
a1839621 2243517a

+1 -1
+1 -1
kernel/torture.c
··· 93 93 { 94 94 ktime_t hto = baset_ns; 95 95 96 - if (trsp) 96 + if (trsp && fuzzt_ns) 97 97 hto += torture_random(trsp) % fuzzt_ns; 98 98 set_current_state(TASK_IDLE); 99 99 return schedule_hrtimeout(&hto, mode);