sched/clock: add nsec range check in clock_settime
MIRTOS-109 Return error when tv_nsec <0 or >=1000 million. Change-Id: Iddbbcda163cb402551f619efb7486f6798859d57 Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
parent
95b5dc523e
commit
8a47dd95c9
|
@ -64,7 +64,8 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
|
|||
* time clock.
|
||||
*/
|
||||
|
||||
if (clock_id == CLOCK_REALTIME)
|
||||
if (clock_id == CLOCK_REALTIME &&
|
||||
tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000)
|
||||
{
|
||||
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
||||
/* Interrupts are disabled here so that the in-memory time
|
||||
|
|
Loading…
Reference in New Issue