Re: [PATCH -next v3 1/2] posix-timers: Check timespec64 before call clock_set()

From: Richard Cochran
Date: Mon Sep 09 2024 - 11:20:42 EST


On Mon, Sep 09, 2024 at 03:41:23PM +0800, Jinjie Ruan wrote:
> diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
> index 1cc830ef93a7..34deec619e17 100644
> --- a/kernel/time/posix-timers.c
> +++ b/kernel/time/posix-timers.c
> @@ -1137,6 +1137,9 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock,
> if (get_timespec64(&new_tp, tp))
> return -EFAULT;
>
> + if (!timespec64_valid(&new_tp))
> + return -ERANGE;

Why not use timespec64_valid_settod()?

Thanks,
Richard