mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
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:
committed by
Gustavo Henrique Nihei
parent
95b5dc523e
commit
8a47dd95c9
@@ -64,7 +64,8 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
|
|||||||
* time clock.
|
* time clock.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (clock_id == CLOCK_REALTIME)
|
if (clock_id == CLOCK_REALTIME &&
|
||||||
|
tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
#ifndef CONFIG_CLOCK_TIMEKEEPING
|
||||||
/* Interrupts are disabled here so that the in-memory time
|
/* Interrupts are disabled here so that the in-memory time
|
||||||
|
|||||||
Reference in New Issue
Block a user