lkml.org 
[lkml]   [2021]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH -next v2] optee: Fix NULL but dereferenced coccicheck error
On Mon, Nov 22, 2021 at 3:20 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>
> ---
>
> change in v2:
> --According to Jens's suggestion
> fixed as:
> if (memremaped_shm)
> memunmap(memremaped_shm);
>
> drivers/tee/optee/smc_abi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to https://git.linaro.org/people/jens.wiklander/linux-tee.git/
async_notif

Thanks,
Jens

>
> diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c
> index 92759d7..d7c8235 100644
> --- a/drivers/tee/optee/smc_abi.c
> +++ b/drivers/tee/optee/smc_abi.c
> @@ -1505,8 +1505,8 @@ 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);
> + if (memremaped_shm)
> + memunmap(memremaped_shm);
> return rc;
> }
>
> --
> 1.8.3.1
>

\
 
 \ /
  Last update: 2021-11-29 10:07    [W:0.827 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site