[PATCH] optee: smc_abi.c: fix wrong pointer passed to IS_ERR/PTR_ERR()

Yang Yingliang posted 1 patch 3 years, 9 months ago
drivers/tee/optee/smc_abi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] optee: smc_abi.c: fix wrong pointer passed to IS_ERR/PTR_ERR()
Posted by Yang Yingliang 3 years, 9 months ago
It should be 'rpc_arg' pass to IS_ERR/PTR_ERR().

Fixes: ed8faf6c8f8c ("optee: add OPTEE_SMC_CALL_WITH_RPC_ARG and OPTEE_SMC_CALL_WITH_REGD_ARG")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/tee/optee/smc_abi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
index 385cb0aee610..a1c1fa1a9c28 100644
--- a/drivers/tee/optee/smc_abi.c
+++ b/drivers/tee/optee/smc_abi.c
@@ -884,8 +884,8 @@ static int optee_smc_do_call_with_arg(struct tee_context *ctx,
 
 		rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
 		rpc_arg = tee_shm_get_va(shm, offs + rpc_arg_offs);
-		if (IS_ERR(arg))
-			return PTR_ERR(arg);
+		if (IS_ERR(rpc_arg))
+			return PTR_ERR(rpc_arg);
 	}
 
 	if  (rpc_arg && tee_shm_is_dynamic(shm)) {
-- 
2.25.1
Re: [PATCH] optee: smc_abi.c: fix wrong pointer passed to IS_ERR/PTR_ERR()
Posted by Jens Wiklander 3 years, 9 months ago
On Tue, Jun 28, 2022 at 8:42 AM Yang Yingliang <yangyingliang@huawei.com> wrote:
>
> It should be 'rpc_arg' pass to IS_ERR/PTR_ERR().
>
> Fixes: ed8faf6c8f8c ("optee: add OPTEE_SMC_CALL_WITH_RPC_ARG and OPTEE_SMC_CALL_WITH_REGD_ARG")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/tee/optee/smc_abi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

I'm picking up this. I've added some description in the commit message.

Thanks,
Jens

>
> diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
> index 385cb0aee610..a1c1fa1a9c28 100644
> --- a/drivers/tee/optee/smc_abi.c
> +++ b/drivers/tee/optee/smc_abi.c
> @@ -884,8 +884,8 @@ static int optee_smc_do_call_with_arg(struct tee_context *ctx,
>
>                 rpc_arg_offs = OPTEE_MSG_GET_ARG_SIZE(arg->num_params);
>                 rpc_arg = tee_shm_get_va(shm, offs + rpc_arg_offs);
> -               if (IS_ERR(arg))
> -                       return PTR_ERR(arg);
> +               if (IS_ERR(rpc_arg))
> +                       return PTR_ERR(rpc_arg);
>         }
>
>         if  (rpc_arg && tee_shm_is_dynamic(shm)) {
> --
> 2.25.1
>