[Cbe-oss-dev] [PATCH 8/9]MARS: Task get name return null

Kazunori Asayama asayama at sm.sony.co.jp
Mon Oct 20 16:49:35 EST 2008


Yuji Mano wrote:
> This fixes mars_task_get_name function so that if user specified NULL during
> task creation, NULL will be returned rather than a pointer to an uninitialized
> string array.
> 
> Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
> 
> ---
>  src/host/lib/task.c |    4 +++-
>  src/mpu/lib/task.c  |    4 +++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> --- a/src/host/lib/task.c
> +++ b/src/host/lib/task.c
> @@ -98,8 +98,10 @@ int mars_task_create(struct mars_context
>  	/* initialize task id */
>  	task->id.mars_context_ea = mars_ptr_to_ea(mars);
>  	task->id.workload_id = workload_id;
> -	if (name)
> +	if (name && strlen(name))
>  		strcpy((char *)task->id.name, name);

You can just say 'if (name)'.

> +	else
> +		task->id.name[0] = 0;
>  
>  	/* initialize the elf parameters */
>  	task->exec_ea = mars_ptr_to_ea((void *)ehdr + phdr->p_offset);

-- 
(ASAYAMA Kazunori
  (asayama at sm.sony.co.jp))
t



More information about the cbe-oss-dev mailing list