Commit 64b534dc authored by Yuyao Lin's avatar Yuyao Lin Committed by Zheng Zengkai
Browse files

Revert "posix-cpu-timers: Make timespec to nsec conversion safe"

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I61XP8



--------------------------------

This reverts commit 098b0e01.

Function timespec64_to_ns() Add the upper and lower limits check in
commit cb477557 ("time: Prevent undefined behaviour in timespec64_to_ns()"),
timespec64_to_ktime() only check the upper limits,so revert this patch
can fix overflow.

Signed-off-by: default avatarYuyao Lin <linyuyao1@huawei.com>
Reviewed-by: default avatarWei Li <liwei391@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 0514826e
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -591,11 +591,7 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
		return -ESRCH;
	}

	/*
	 * Use the to_ktime conversion because that clamps the maximum
	 * value to KTIME_MAX and avoid multiplication overflows.
	 */
	new_expires = ktime_to_ns(timespec64_to_ktime(new->it_value));
	new_expires = timespec64_to_ns(&new->it_value);

	/*
	 * Protect against sighand release/switch in exit/exec and p->cpu_timers