All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] optee: Fix NULL but dereferenced coccicheck error
@ 2021-11-19  8:05 Yang Li
  2021-11-19 12:04 ` Jens Wiklander
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-11-19  8:05 UTC (permalink / raw)
  To: jens.wiklander; +Cc: sumit.garg, op-tee, linux-kernel, Yang Li

Eliminate the following coccicheck warning:
./drivers/tee/optee/smc_abi.c:1508:12-15: ERROR: optee is NULL but
dereferenced.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 'commit 6749e69c4dad ("optee: add asynchronous notifications")'
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/tee/optee/smc_abi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
index 92759d7..1f471ff 100644
--- a/drivers/tee/optee/smc_abi.c
+++ b/drivers/tee/optee/smc_abi.c
@@ -1505,8 +1505,6 @@ static int optee_probe(struct platform_device *pdev)
 	kfree(optee);
 err_free_pool:
 	tee_shm_pool_free(pool);
-	if (optee->smc.memremaped_shm)
-		memunmap(optee->smc.memremaped_shm);
 	return rc;
 }
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] optee: Fix NULL but dereferenced coccicheck error
  2021-11-19  8:05 [PATCH -next] optee: Fix NULL but dereferenced coccicheck error Yang Li
@ 2021-11-19 12:04 ` Jens Wiklander
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Wiklander @ 2021-11-19 12:04 UTC (permalink / raw)
  To: Yang Li; +Cc: sumit.garg, op-tee, linux-kernel

On Fri, Nov 19, 2021 at 9:05 AM Yang Li <yang.lee@linux.alibaba.com> wrote:
>
> Eliminate the following coccicheck warning:
> ./drivers/tee/optee/smc_abi.c:1508:12-15: ERROR: optee is NULL but
> dereferenced.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Fixes: 'commit 6749e69c4dad ("optee: add asynchronous notifications")'
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/tee/optee/smc_abi.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
> index 92759d7..1f471ff 100644
> --- a/drivers/tee/optee/smc_abi.c
> +++ b/drivers/tee/optee/smc_abi.c
> @@ -1505,8 +1505,6 @@ static int optee_probe(struct platform_device *pdev)
>         kfree(optee);
>  err_free_pool:
>         tee_shm_pool_free(pool);
> -       if (optee->smc.memremaped_shm)
> -               memunmap(optee->smc.memremaped_shm);

Thanks for reporting. This should rather be fixed as:
        if (memremaped_shm)
                memunmap(memremaped_shm);

Cheers,
Jens

>         return rc;
>  }
>
> --
> 1.8.3.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-19 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  8:05 [PATCH -next] optee: Fix NULL but dereferenced coccicheck error Yang Li
2021-11-19 12:04 ` Jens Wiklander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.