|
@@ -152,8 +152,12 @@ static void set_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
|
|
|
u64 oval, nval, ointerval, ninterval;
|
|
|
struct cpu_itimer *it = &tsk->signal->it[clock_id];
|
|
|
|
|
|
- nval = timeval_to_ns(&value->it_value);
|
|
|
- ninterval = timeval_to_ns(&value->it_interval);
|
|
|
+ /*
|
|
|
+ * Use the to_ktime conversion because that clamps the maximum
|
|
|
+ * value to KTIME_MAX and avoid multiplication overflows.
|
|
|
+ */
|
|
|
+ nval = ktime_to_ns(timeval_to_ktime(value->it_value));
|
|
|
+ ninterval = ktime_to_ns(timeval_to_ktime(value->it_interval));
|
|
|
|
|
|
spin_lock_irq(&tsk->sighand->siglock);
|
|
|
|