public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yang Li <yang.lee@linux.alibaba.com>
To: jens.wiklander@linaro.org
Cc: sumit.garg@linaro.org, op-tee@lists.trustedfirmware.org,
	linux-kernel@vger.kernel.org,
	Yang Li <yang.lee@linux.alibaba.com>
Subject: [PATCH -next v2] optee: Fix NULL but dereferenced coccicheck error
Date: Mon, 22 Nov 2021 10:20:50 +0800	[thread overview]
Message-ID: <1637547650-4205-1-git-send-email-yang.lee@linux.alibaba.com> (raw)

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(-)

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


             reply	other threads:[~2021-11-22  2:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22  2:20 Yang Li [this message]
2021-11-29  8:54 ` [PATCH -next v2] optee: Fix NULL but dereferenced coccicheck error Jens Wiklander

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1637547650-4205-1-git-send-email-yang.lee@linux.alibaba.com \
    --to=yang.lee@linux.alibaba.com \
    --cc=jens.wiklander@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=sumit.garg@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox