Skip to content

Commit

Permalink
sched: Make sure that affinity mask is valid
Browse files Browse the repository at this point in the history
Signed-off-by: hujun5 <hujun5@xiaomi.com>
  • Loading branch information
hujun260 committed Sep 4, 2024
1 parent f084685 commit 269f6a5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sched/sched/sched_setaffinity.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ int nxsched_set_affinity(pid_t pid, size_t cpusetsize,

DEBUGASSERT(cpusetsize == sizeof(cpu_set_t) && mask != NULL);

/* Make sure that affinity mask is valid */

if (*mask == 0)
{
return -EINVAL;
}

/* Verify that the PID corresponds to a real task */

if (!pid)
Expand Down

0 comments on commit 269f6a5

Please sign in to comment.