mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
crypto: tegra: Fix coverity and CERT C defects
Fix the following coverity defects. ID 10181328, CID 687742 - Uninitialized variable ID 10181331 - Dead code ID 10181330, CID 687711 - Uninitialize variable ID 10181332 - Potential overflow ID 10181329 - Wrong data type Bug 3952896 Bug 3959323 Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Change-Id: I62064ee9b0cef4ad78a1aa4980637fcd3df682d6 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2995805 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
59b14ea0b8
commit
3926014666
@@ -1216,8 +1216,6 @@ static int tegra_ccm_do_one_req(struct crypto_engine *engine, void *areq)
|
|||||||
goto out;
|
goto out;
|
||||||
} else {
|
} else {
|
||||||
rctx->cryptlen = req->cryptlen - ctx->authsize;
|
rctx->cryptlen = req->cryptlen - ctx->authsize;
|
||||||
if (ret)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
/* CTR operation */
|
/* CTR operation */
|
||||||
ret = tegra_ccm_do_ctr(ctx, rctx);
|
ret = tegra_ccm_do_ctr(ctx, rctx);
|
||||||
@@ -1614,7 +1612,7 @@ static int tegra_cmac_do_one_req(struct crypto_engine *engine, void *areq)
|
|||||||
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
|
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
|
||||||
struct tegra_cmac_ctx *ctx = crypto_ahash_ctx(tfm);
|
struct tegra_cmac_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||||
struct tegra_se *se = ctx->se;
|
struct tegra_se *se = ctx->se;
|
||||||
int ret;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (rctx->task & SHA_UPDATE) {
|
if (rctx->task & SHA_UPDATE) {
|
||||||
ret = tegra_cmac_do_update(req);
|
ret = tegra_cmac_do_update(req);
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ static int tegra_sha_prep_cmd(struct tegra_se *se, u32 *cpuvaddr,
|
|||||||
u64 msg_len, msg_left;
|
u64 msg_len, msg_left;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
msg_len = rctx->total_len * 8;
|
msg_len = (u64)rctx->total_len * 8;
|
||||||
msg_left = rctx->datbuf.size * 8;
|
msg_left = (u64)rctx->datbuf.size * 8;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If IN_ADDR_HI_0.SZ > SHA_MSG_LEFT_[0-3] to the HASH engine,
|
* If IN_ADDR_HI_0.SZ > SHA_MSG_LEFT_[0-3] to the HASH engine,
|
||||||
@@ -377,7 +377,7 @@ static int tegra_sha_do_one_req(struct crypto_engine *engine, void *areq)
|
|||||||
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
|
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
|
||||||
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
struct tegra_sha_ctx *ctx = crypto_ahash_ctx(tfm);
|
||||||
struct tegra_se *se = ctx->se;
|
struct tegra_se *se = ctx->se;
|
||||||
int ret;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (rctx->task & SHA_UPDATE) {
|
if (rctx->task & SHA_UPDATE) {
|
||||||
ret = tegra_sha_do_update(req);
|
ret = tegra_sha_do_update(req);
|
||||||
|
|||||||
@@ -440,9 +440,9 @@ struct tegra_se {
|
|||||||
struct device *dev;
|
struct device *dev;
|
||||||
unsigned int opcode_addr;
|
unsigned int opcode_addr;
|
||||||
unsigned int stream_id;
|
unsigned int stream_id;
|
||||||
unsigned int num_clks;
|
|
||||||
unsigned int syncpt_id;
|
unsigned int syncpt_id;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
int num_clks;
|
||||||
u32 owner;
|
u32 owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user