vhost/crypto: fix inferred misuse of enum

Message ID 20181101141504.23491-1-roy.fan.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series vhost/crypto: fix inferred misuse of enum |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Fan Zhang Nov. 1, 2018, 2:15 p.m. UTC
  Fix inffered misuse of enum rte_crypto_cipher_algorithm and
rte_crypto_auth_algorithm

Coverity issue 277202

Fixes: e80a98708166 ("vhost/crypto: add session message handler")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
---
 lib/librte_vhost/vhost_crypto.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Ferruh Yigit Nov. 2, 2018, 8:22 p.m. UTC | #1
On 11/1/2018 2:15 PM, stable-bounces@dpdk.org wrote:
> Fix inffered misuse of enum rte_crypto_cipher_algorithm and
> rte_crypto_auth_algorithm
> 
> Coverity issue 277202
> 
> Fixes: e80a98708166 ("vhost/crypto: add session message handler")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Ferruh Yigit Nov. 2, 2018, 8:37 p.m. UTC | #2
On 11/2/2018 8:22 PM, Ferruh Yigit wrote:
> On 11/1/2018 2:15 PM, stable-bounces@dpdk.org wrote:
>> Fix inffered misuse of enum rte_crypto_cipher_algorithm and
>> rte_crypto_auth_algorithm
>>
>> Coverity issue 277202
>>
>> Fixes: e80a98708166 ("vhost/crypto: add session message handler")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> 
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.
  

Patch

diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index 9811a232a..5472bead0 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -238,7 +238,7 @@  transform_cipher_param(struct rte_crypto_sym_xform *xform,
 		return ret;
 
 	xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
-	xform->cipher.algo = (uint32_t)ret;
+	xform->cipher.algo = (enum rte_crypto_cipher_algorithm)ret;
 	xform->cipher.key.length = param->cipher_key_len;
 	if (xform->cipher.key.length > 0)
 		xform->cipher.key.data = param->cipher_key_buf;
@@ -288,7 +288,7 @@  transform_chain_param(struct rte_crypto_sym_xform *xforms,
 	if (unlikely(ret < 0))
 		return ret;
 	xform_cipher->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
-	xform_cipher->cipher.algo = (uint32_t)ret;
+	xform_cipher->cipher.algo = (enum rte_crypto_cipher_algorithm)ret;
 	xform_cipher->cipher.key.length = param->cipher_key_len;
 	xform_cipher->cipher.key.data = param->cipher_key_buf;
 	ret = get_iv_len(xform_cipher->cipher.algo);
@@ -302,7 +302,7 @@  transform_chain_param(struct rte_crypto_sym_xform *xforms,
 	ret = auth_algo_transform(param->hash_algo);
 	if (unlikely(ret < 0))
 		return ret;
-	xform_auth->auth.algo = (uint32_t)ret;
+	xform_auth->auth.algo = (enum rte_crypto_auth_algorithm)ret;
 	xform_auth->auth.digest_length = param->digest_len;
 	xform_auth->auth.key.length = param->auth_key_len;
 	xform_auth->auth.key.data = param->auth_key_buf;