Skip to content

Commit 048f20b

Browse files
committed
crypto: tegra - check return value for hash do_one_req
jira LE-4159 Rebuild_History Non-Buildable kernel-5.14.0-570.41.1.el9_6 commit-author Akhil R <akhilrajeev@nvidia.com> commit dcf8b7e 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: 0880bb3 ("crypto: tegra - Add Tegra Security Engine driver") Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> (cherry picked from commit dcf8b7e) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 02f7be5 commit 048f20b

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

drivers/crypto/tegra/tegra-se-aes.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,18 +1602,24 @@ static int tegra_cmac_do_one_req(struct crypto_engine *engine, void *areq)
16021602
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
16031603
struct tegra_cmac_ctx *ctx = crypto_ahash_ctx(tfm);
16041604
struct tegra_se *se = ctx->se;
1605-
int ret;
1605+
int ret = 0;
16061606

16071607
if (rctx->task & SHA_UPDATE) {
16081608
ret = tegra_cmac_do_update(req);
1609+
if (ret)
1610+
goto out;
1611+
16091612
rctx->task &= ~SHA_UPDATE;
16101613
}
16111614

16121615
if (rctx->task & SHA_FINAL) {
16131616
ret = tegra_cmac_do_final(req);
1617+
if (ret)
1618+
goto out;
1619+
16141620
rctx->task &= ~SHA_FINAL;
16151621
}
1616-
1622+
out:
16171623
crypto_finalize_hash_request(se->engine, req, ret);
16181624

16191625
return 0;

drivers/crypto/tegra/tegra-se-hash.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,14 +437,21 @@ static int tegra_sha_do_one_req(struct crypto_engine *engine, void *areq)
437437

438438
if (rctx->task & SHA_UPDATE) {
439439
ret = tegra_sha_do_update(req);
440+
if (ret)
441+
goto out;
442+
440443
rctx->task &= ~SHA_UPDATE;
441444
}
442445

443446
if (rctx->task & SHA_FINAL) {
444447
ret = tegra_sha_do_final(req);
448+
if (ret)
449+
goto out;
450+
445451
rctx->task &= ~SHA_FINAL;
446452
}
447453

454+
out:
448455
crypto_finalize_hash_request(se->engine, req, ret);
449456

450457
return 0;

0 commit comments

Comments
 (0)