sched: handle nxtask_setup_arguments return values

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2022-05-31 16:58:07 +08:00 committed by Xiang Xiao
parent 1f854486c3
commit db08f3a723
3 changed files with 13 additions and 3 deletions

View File

@ -157,7 +157,11 @@ int nxtask_init(FAR struct task_tcb_s *tcb, const char *name, int priority,
/* Setup to pass parameters to the new task */
nxtask_setup_arguments(tcb, name, argv);
ret = nxtask_setup_arguments(tcb, name, argv);
if (ret < OK)
{
goto errout_with_group;
}
/* Now we have enough in place that we can join the group */

View File

@ -545,6 +545,7 @@ static int nxtask_setup_stackargs(FAR struct task_tcb_s *tcb,
*/
strtablen += (strlen(argv[argc]) + 1);
DEBUGASSERT(strtablen < tcb->cmn.adj_stack_size);
if (strtablen >= tcb->cmn.adj_stack_size)
{
return -ENAMETOOLONG;
@ -556,6 +557,7 @@ static int nxtask_setup_stackargs(FAR struct task_tcb_s *tcb,
* happens in normal usage.
*/
DEBUGASSERT(argc <= MAX_STACK_ARGS);
if (++argc > MAX_STACK_ARGS)
{
return -E2BIG;

View File

@ -204,8 +204,12 @@ FAR struct task_tcb_s *nxtask_setup_vfork(start_t retaddr)
/* Setup to pass parameters to the new task */
nxtask_setup_arguments(child, parent->group->tg_info->argv[0],
&parent->group->tg_info->argv[1]);
ret = nxtask_setup_arguments(child, parent->group->tg_info->argv[0],
&parent->group->tg_info->argv[1]);
if (ret < OK)
{
goto errout_with_tcb;
}
/* Now we have enough in place that we can join the group */