From beec3e4d80c09477cb4f9a479700586742a3494d Mon Sep 17 00:00:00 2001 From: yintao Date: Thu, 8 Sep 2022 17:08:49 +0800 Subject: [PATCH] fix run ltp_interfaces_sched_setscheduler_17_1 fail The policy has changed when sched_setscheduler called invalid args. Signed-off-by: yintao --- sched/sched/sched_setscheduler.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c index 12a7584896d..2cae203a951 100644 --- a/sched/sched/sched_setscheduler.c +++ b/sched/sched/sched_setscheduler.c @@ -96,6 +96,14 @@ int nxsched_set_scheduler(pid_t pid, int policy, return -EINVAL; } + /* Verify that the requested priority is in the valid range */ + + if (param->sched_priority < SCHED_PRIORITY_MIN || + param->sched_priority > SCHED_PRIORITY_MAX) + { + return -EINVAL; + } + /* Check if the task to modify the calling task */ if (pid == 0)