Skip to contentSkip to conversation

optee: Fix NULL but dereferenced coccicheck error

PATCH Superseded Yang Li 2 participants 2 messages Nov 19, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Li

author
#0 lore raw

PATCH 1/1 optee: Fix NULL but dereferenced coccicheck error

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

Fixes 'commit 6749e69c4dad ("optee: add asynchronous notifications")'
---
 drivers/tee/optee/smc_abi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/tee/optee/smc_abi.c +0 -2
index 92759d7..1f471ff 100644
@@ -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;
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 17 lines · Yang Li

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

Fixes 'commit 6749e69c4dad ("optee: add asynchronous notifications")'
---
 drivers/tee/optee/smc_abi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/tee/optee/smc_abi.c +0 -0
index 92759d7..1f471ff 100644

drivers/tee/optee/smc_abi.c static int optee_probe(struct platform_device *pdev) · line 1509

Quoted 5 lines
drivers/tee/optee/smc_abi.c +0 -2
@@ -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

Quoted 6 lines
drivers/tee/optee/smc_abi.c +0 -1
        return rc;
 }
 
--

1.8.3.1