Merged in david_s5/nuttx/upstream_prio_lpwork (pull request #271)

lp_worker:Guard from pend_reprios overlow

Approved-by: Gregory Nutt
This commit is contained in:
David Sidrane 2017-03-15 17:50:59 +00:00 committed by Gregory Nutt
commit 89717094eb

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->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
@ -129,8 +134,16 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
* saved priority and not to the base priority.
*/
wtcb->pend_reprios[wtcb->npend_reprio] = reqprio;
wtcb->npend_reprio++;
if (wtcb->npend_reprio < CONFIG_SEM_NNESTPRIO)
{
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