On 2024/11/7 21:13, Akhil R wrote: >> From: Chen Ridong <chenridong@xxxxxxxxxx> >> >> The tegra_sha_init function may return an error when memory is exhausted. >> It should not transfer the request when tegra_sha_init returns an error. >> >> Fixes: 0880bb3b00c8 ("crypto: tegra - Add Tegra Security Engine driver") >> Signed-off-by: Chen Ridong <chenridong@xxxxxxxxxx> >> --- >> drivers/crypto/tegra/tegra-se-hash.c | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/crypto/tegra/tegra-se-hash.c b/drivers/crypto/tegra/tegra-se- >> hash.c >> index 4d4bd727f498..7e888bf5f66a 100644 >> --- a/drivers/crypto/tegra/tegra-se-hash.c >> +++ b/drivers/crypto/tegra/tegra-se-hash.c >> @@ -612,6 +612,7 @@ static int tegra_sha_finup(struct ahash_request *req) >> >> static int tegra_sha_digest(struct ahash_request *req) >> { >> + int ret; > > I would suggest moving this variable to below other variables for aesthetics. > Same with the other patch for tegra_cmac_init() as well. > . >> struct tegra_sha_reqctx *rctx = ahash_request_ctx(req); >> struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); >> struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm); >> @@ -619,9 +620,11 @@ static int tegra_sha_digest(struct ahash_request *req) >> if (ctx->fallback) >> return tegra_sha_fallback_digest(req); >> >> - tegra_sha_init(req); >> - rctx->task |= SHA_UPDATE | SHA_FINAL; >> + ret = tegra_sha_init(req); >> + if (ret) >> + return ret; >> >> + rctx->task |= SHA_UPDATE | SHA_FINAL; >> return crypto_transfer_hash_request_to_engine(ctx->se->engine, req); >> } >> >> -- >> 2.34.1 > > I think this can be combined with the other patch for tegra_cma_init() as both are similar > fix. Apart from the minor comment above regarding the variable position, LGTM. > > Acked-by: Akhil R <akhilrajeev@xxxxxxxxxx> > Thanks,will update Best regards, Ridong