diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c index a302e6e660e..61e8c7a1b04 100644 --- a/sched/sched/sched_setparam.c +++ b/sched/sched/sched_setparam.c @@ -187,6 +187,12 @@ int nxsched_set_param(pid_t pid, FAR const struct sched_param *param) if (param != NULL) { + if (param->sched_priority < SCHED_PRIORITY_MIN || + param->sched_priority > SCHED_PRIORITY_MAX) + { + return -EINVAL; + } + /* Prohibit modifications to the head of the ready-to-run task * list while adjusting the priority */