summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorUbuntu <[email protected]>2019-12-13 23:56:37 +0000
committerBrian Behlendorf <[email protected]>2019-12-18 17:23:54 -0800
commit5215fdd43c3edd25897b8257d802b68ca5583646 (patch)
tree9d839e03af837a6ba0465208c02b9dce71d93988 /module
parentb8a899e94ff8464dc538dbcdd7864ed49ef279a8 (diff)
cppcheck: (error) Uninitialized variable
Resolve the following uninitialized variable warnings. In practice these were unreachable due to the goto. Replacing the goto with a return resolves the warning and yields more readable code. [module/icp/algs/modes/ccm.c:892]: (error) Uninitialized variable: ccm_param [module/icp/algs/modes/ccm.c:893]: (error) Uninitialized variable: ccm_param [module/icp/algs/modes/gcm.c:564]: (error) Uninitialized variable: gcm_param [module/icp/algs/modes/gcm.c:565]: (error) Uninitialized variable: gcm_param [module/icp/algs/modes/gcm.c:599]: (error) Uninitialized variable: gmac_param [module/icp/algs/modes/gcm.c:600]: (error) Uninitialized variable: gmac_param Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #9732
Diffstat (limited to 'module')
-rw-r--r--module/icp/algs/modes/ccm.c7
-rw-r--r--module/icp/algs/modes/gcm.c10
2 files changed, 6 insertions, 11 deletions
diff --git a/module/icp/algs/modes/ccm.c b/module/icp/algs/modes/ccm.c
index fb41194f8..f4075f503 100644
--- a/module/icp/algs/modes/ccm.c
+++ b/module/icp/algs/modes/ccm.c
@@ -885,15 +885,13 @@ ccm_init_ctx(ccm_ctx_t *ccm_ctx, char *param, int kmflag,
ccm_ctx->ccm_flags |= CCM_MODE;
} else {
- rv = CRYPTO_MECHANISM_PARAM_INVALID;
- goto out;
+ return (CRYPTO_MECHANISM_PARAM_INVALID);
}
if (ccm_init(ccm_ctx, ccm_param->nonce, ccm_param->ulNonceSize,
ccm_param->authData, ccm_param->ulAuthDataSize, block_size,
encrypt_block, xor_block) != 0) {
- rv = CRYPTO_MECHANISM_PARAM_INVALID;
- goto out;
+ return (CRYPTO_MECHANISM_PARAM_INVALID);
}
if (!is_encrypt_init) {
/* allocate buffer for storing decrypted plaintext */
@@ -903,7 +901,6 @@ ccm_init_ctx(ccm_ctx_t *ccm_ctx, char *param, int kmflag,
rv = CRYPTO_HOST_MEMORY;
}
}
-out:
return (rv);
}
diff --git a/module/icp/algs/modes/gcm.c b/module/icp/algs/modes/gcm.c
index 71ea16d24..8d1b8822a 100644
--- a/module/icp/algs/modes/gcm.c
+++ b/module/icp/algs/modes/gcm.c
@@ -557,8 +557,7 @@ gcm_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
rv = CRYPTO_SUCCESS;
gcm_ctx->gcm_flags |= GCM_MODE;
} else {
- rv = CRYPTO_MECHANISM_PARAM_INVALID;
- goto out;
+ return (CRYPTO_MECHANISM_PARAM_INVALID);
}
if (gcm_init(gcm_ctx, gcm_param->pIv, gcm_param->ulIvLen,
@@ -566,7 +565,7 @@ gcm_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
encrypt_block, copy_block, xor_block) != 0) {
rv = CRYPTO_MECHANISM_PARAM_INVALID;
}
-out:
+
return (rv);
}
@@ -592,8 +591,7 @@ gmac_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
rv = CRYPTO_SUCCESS;
gcm_ctx->gcm_flags |= GMAC_MODE;
} else {
- rv = CRYPTO_MECHANISM_PARAM_INVALID;
- goto out;
+ return (CRYPTO_MECHANISM_PARAM_INVALID);
}
if (gcm_init(gcm_ctx, gmac_param->pIv, AES_GMAC_IV_LEN,
@@ -601,7 +599,7 @@ gmac_init_ctx(gcm_ctx_t *gcm_ctx, char *param, size_t block_size,
encrypt_block, copy_block, xor_block) != 0) {
rv = CRYPTO_MECHANISM_PARAM_INVALID;
}
-out:
+
return (rv);
}