Skip to content

Commit 555c07e

Browse files
TaiJuWunashif
authored andcommitted
sched: Limit deadline scheduler parameter
The deadline of deadline scheduler should lager than zero because if deadline is negative, it menas the task should be finished in past. Signed-off-by: TaiJu Wu <[email protected]>
1 parent ea3a47e commit 555c07e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/sched.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,9 @@ static inline void z_vrfy_k_thread_priority_set(k_tid_t thread, int prio)
10581058
#ifdef CONFIG_SCHED_DEADLINE
10591059
void z_impl_k_thread_deadline_set(k_tid_t tid, int deadline)
10601060
{
1061+
1062+
deadline = CLAMP(deadline, 0, INT_MAX);
1063+
10611064
struct k_thread *thread = tid;
10621065
int32_t newdl = k_cycle_get_32() + deadline;
10631066

0 commit comments

Comments
 (0)