Guard from pend_reprios overlow

This commit is contained in:
David Sidrane 2017-03-15 07:42:55 -10:00
parent e1039128a4
commit 55fb9645a7

View File

@ -110,6 +110,11 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
wtcb->pend_reprios[wtcb->npend_reprio] = wtcb->sched_priority; wtcb->pend_reprios[wtcb->npend_reprio] = wtcb->sched_priority;
wtcb->npend_reprio++; wtcb->npend_reprio++;
} }
else
{
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
}
} }
/* Raise the priority of the worker. This cannot cause a context /* Raise the priority of the worker. This cannot cause a context
@ -129,8 +134,16 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
* saved priority and not to the base priority. * saved priority and not to the base priority.
*/ */
wtcb->pend_reprios[wtcb->npend_reprio] = reqprio; if (wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
wtcb->npend_reprio++; {
wtcb->pend_reprios[wtcb->npend_reprio] = reqprio;
wtcb->npend_reprio++;
}
else
{
serr("ERROR: CONFIG_SEM_NNESTPRIO exceeded\n");
DEBUGASSERT(wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO);
}
} }
} }
#else #else