[PATCH] cmd: optee: fix hello subcommand argument check

Jerome Forissier jerome.forissier at linaro.org
Fri Apr 4 14:58:46 CEST 2025



On 4/4/25 14:53, Vincent Stehlé wrote:
> When the `optee hello' subcommand is called, the do_optee_hello_world_ta()
> function passes a NULL pointer to the strcmp() function while verifying its
> input argument, which results in the following crash:
> 
>   => optee hello
>   "Synchronous Abort" handler, esr 0x96000010, far 0x0
> 
> Fix this by verifying the number of input arguments instead.
> 
> Fixes: e3cf80fbe02d ("cmd: Add support for optee commands")
> Signed-off-by: Vincent Stehlé <vincent.stehle at arm.com>
> Cc: Jens Wiklander <jens.wiklander at linaro.org>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Jerome Forissier <jerome.forissier at linaro.org>
> Cc: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
> ---
>  cmd/optee.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/cmd/optee.c b/cmd/optee.c
> index d0d37293986..e3aae5e9f9b 100644
> --- a/cmd/optee.c
> +++ b/cmd/optee.c
> @@ -53,7 +53,7 @@ static int do_optee_hello_world_ta(struct cmd_tbl *cmdtp, int flag, int argc,
>  {
>  	int ret, value = 0;
>  
> -	if (strcmp(argv[1], NULL))
> +	if (argc > 1)
>  		value = hextoul(argv[1], NULL);
>  
>  	ret = hello_world_ta(value);

How did I miss that? :O Anyways...

Reviewed-by: Jerome Forissier <jerome.forissier at linaro.org>

Thanks!
-- 
Jerome


More information about the U-Boot mailing list