mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akhil R <akhilrajeev@nvidia.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
	<linux-crypto@vger.kernel.org>, <linux-tegra@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: Akhil R <akhilrajeev@nvidia.com>,
	kernel test robot <lkp@intel.com>,
	"Dan Carpenter" <dan.carpenter@linaro.org>
Subject: [PATCH v3 04/10] crypto: tegra: check return value for hash do_one_req
Date: Mon, 24 Feb 2025 14:46:04 +0530	[thread overview]
Message-ID: <20250224091610.49683-5-akhilrajeev@nvidia.com> (raw)
In-Reply-To: <20250224091610.49683-1-akhilrajeev@nvidia.com>

Initialize and check the return value in hash *do_one_req() functions
and exit the function if there is an error. This fixes the
'uninitialized variable' warnings reported by testbots.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202412071747.flPux4oB-lkp@intel.com/
Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver")
Signed-off-by: Akhil R <akhilrajeev@nvidia.com>
---
 drivers/crypto/tegra/tegra-se-aes.c  | 10 ++++++++--
 drivers/crypto/tegra/tegra-se-hash.c |  7 +++++++
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/tegra/tegra-se-aes.c b/drivers/crypto/tegra/tegra-se-aes.c
index c7bb6f951a84..5ca7996ecc6d 100644
--- a/drivers/crypto/tegra/tegra-se-aes.c
+++ b/drivers/crypto/tegra/tegra-se-aes.c
@@ -1602,18 +1602,24 @@ static int tegra_cmac_do_one_req(struct crypto_engine *engine, void *areq)
 	struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
 	struct tegra_cmac_ctx *ctx = crypto_ahash_ctx(tfm);
 	struct tegra_se *se = ctx->se;
-	int ret;
+	int ret = 0;
 
 	if (rctx->task & SHA_UPDATE) {
 		ret = tegra_cmac_do_update(req);
+		if (ret)
+			goto out;
+
 		rctx->task &= ~SHA_UPDATE;
 	}
 
 	if (rctx->task & SHA_FINAL) {
 		ret = tegra_cmac_do_final(req);
+		if (ret)
+			goto out;
+
 		rctx->task &= ~SHA_FINAL;
 	}
-
+out:
 	crypto_finalize_hash_request(se->engine, req, ret);
 
 	return 0;
diff --git a/drivers/crypto/tegra/tegra-se-hash.c b/drivers/crypto/tegra/tegra-se-hash.c
index b4a179a8febd..0ae5ce67bdd0 100644
--- a/drivers/crypto/tegra/tegra-se-hash.c
+++ b/drivers/crypto/tegra/tegra-se-hash.c
@@ -437,14 +437,21 @@ static int tegra_sha_do_one_req(struct crypto_engine *engine, void *areq)
 
 	if (rctx->task & SHA_UPDATE) {
 		ret = tegra_sha_do_update(req);
+		if (ret)
+			goto out;
+
 		rctx->task &= ~SHA_UPDATE;
 	}
 
 	if (rctx->task & SHA_FINAL) {
 		ret = tegra_sha_do_final(req);
+		if (ret)
+			goto out;
+
 		rctx->task &= ~SHA_FINAL;
 	}
 
+out:
 	crypto_finalize_hash_request(se->engine, req, ret);
 
 	return 0;
-- 
2.43.2


  parent reply	other threads:[~2025-02-24  9:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24  9:16 [PATCH v3 00/10] Tegra Security Engine driver improvements Akhil R
2025-02-24  9:16 ` [PATCH v3 01/10] crypto: tegra: Use separate buffer for setkey Akhil R
2025-02-24  9:16 ` [PATCH v3 02/10] crypto: tegra: Do not use fixed size buffers Akhil R
2025-02-24  9:16 ` [PATCH v3 03/10] crypto: tegra: finalize crypto req on error Akhil R
2025-02-24  9:16 ` Akhil R [this message]
2025-02-24  9:16 ` [PATCH v3 05/10] crypto: tegra: Transfer HASH init function to crypto engine Akhil R
2025-02-24  9:16 ` [PATCH v3 06/10] crypto: tegra: Fix HASH intermediate result handling Akhil R
2025-02-24  9:16 ` [PATCH v3 07/10] crypto: tegra: Fix CMAC " Akhil R
2025-02-24  9:16 ` [PATCH v3 08/10] crypto: tegra: Set IV to NULL explicitly for AES ECB Akhil R
2025-02-24  9:16 ` [PATCH v3 09/10] crypto: tegra: Reserve keyslots to allocate dynamically Akhil R
2025-03-05  7:05   ` Akhil R
2025-03-06  8:12     ` Herbert Xu
2025-03-06  8:19       ` Akhil R
2025-02-24  9:16 ` [PATCH v3 10/10] crypto: tegra: Use HMAC fallback when keyslots are full Akhil R
2025-03-08  8:29 ` [PATCH v3 00/10] Tegra Security Engine driver improvements Herbert Xu
2025-04-18 11:45 ` Diederik de Haas
2025-04-19  4:06   ` Herbert Xu
2025-04-19  9:48     ` Diederik de Haas

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=20250224091610.49683-5-akhilrajeev@nvidia.com \
    --to=akhilrajeev@nvidia.com \
    --cc=dan.carpenter@linaro.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jonathanh@nvidia.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=thierry.reding@gmail.com \
    /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

all inboxes | Powered by JetHome®