sched: Make sure that affinity mask is valid

Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
hujun5 2024-08-12 15:29:37 +08:00 committed by Xiang Xiao
parent af19a22b11
commit 855060f353

View file

@ -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)