* [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
@ 2019-05-15 16:09 Fan Zhang
2019-05-15 16:09 ` Fan Zhang
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Fan Zhang @ 2019-05-15 16:09 UTC (permalink / raw)
To: dev; +Cc: maxime.coquelin, Fan Zhang, stable
This patch fixes the inferred misuse of enum of crypto
algorithms.
Coverity issue: 325879
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 | 93 ++++++++++++++++++-----------------------
1 file changed, 41 insertions(+), 52 deletions(-)
diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index 0edf12d52..b812661ef 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -46,116 +46,107 @@
((t)(uintptr_t)vhost_iova_to_vva(r->dev, r->vq, a, l, p))
static int
-cipher_algo_transform(uint32_t virtio_cipher_algo)
+cipher_algo_transform(uint32_t virtio_cipher_algo,
+ enum rte_crypto_cipher_algorithm *algo)
{
- int ret;
-
switch (virtio_cipher_algo) {
case VIRTIO_CRYPTO_CIPHER_AES_CBC:
- ret = RTE_CRYPTO_CIPHER_AES_CBC;
+ *algo = RTE_CRYPTO_CIPHER_AES_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_AES_CTR:
- ret = RTE_CRYPTO_CIPHER_AES_CTR;
+ *algo = RTE_CRYPTO_CIPHER_AES_CTR;
break;
case VIRTIO_CRYPTO_CIPHER_DES_ECB:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = -VIRTIO_CRYPTO_NOTSUPP;
break;
case VIRTIO_CRYPTO_CIPHER_DES_CBC:
- ret = RTE_CRYPTO_CIPHER_DES_CBC;
+ *algo = RTE_CRYPTO_CIPHER_DES_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_3DES_ECB:
- ret = RTE_CRYPTO_CIPHER_3DES_ECB;
+ *algo = RTE_CRYPTO_CIPHER_3DES_ECB;
break;
case VIRTIO_CRYPTO_CIPHER_3DES_CBC:
- ret = RTE_CRYPTO_CIPHER_3DES_CBC;
+ *algo = RTE_CRYPTO_CIPHER_3DES_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_3DES_CTR:
- ret = RTE_CRYPTO_CIPHER_3DES_CTR;
+ *algo = RTE_CRYPTO_CIPHER_3DES_CTR;
break;
case VIRTIO_CRYPTO_CIPHER_KASUMI_F8:
- ret = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ *algo = RTE_CRYPTO_CIPHER_KASUMI_F8;
break;
case VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2:
- ret = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ *algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
break;
case VIRTIO_CRYPTO_CIPHER_AES_F8:
- ret = RTE_CRYPTO_CIPHER_AES_F8;
+ *algo = RTE_CRYPTO_CIPHER_AES_F8;
break;
case VIRTIO_CRYPTO_CIPHER_AES_XTS:
- ret = RTE_CRYPTO_CIPHER_AES_XTS;
+ *algo = RTE_CRYPTO_CIPHER_AES_XTS;
break;
case VIRTIO_CRYPTO_CIPHER_ZUC_EEA3:
- ret = RTE_CRYPTO_CIPHER_ZUC_EEA3;
+ *algo = RTE_CRYPTO_CIPHER_ZUC_EEA3;
break;
default:
- ret = -VIRTIO_CRYPTO_BADMSG;
+ return -VIRTIO_CRYPTO_BADMSG;
break;
}
- return ret;
+ return 0;
}
static int
-auth_algo_transform(uint32_t virtio_auth_algo)
+auth_algo_transform(uint32_t virtio_auth_algo,
+ enum rte_crypto_auth_algorithm *algo)
{
- int ret;
-
switch (virtio_auth_algo) {
-
case VIRTIO_CRYPTO_NO_MAC:
- ret = RTE_CRYPTO_AUTH_NULL;
+ *algo = RTE_CRYPTO_AUTH_NULL;
break;
case VIRTIO_CRYPTO_MAC_HMAC_MD5:
- ret = RTE_CRYPTO_AUTH_MD5_HMAC;
+ *algo = RTE_CRYPTO_AUTH_MD5_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA1:
- ret = RTE_CRYPTO_AUTH_SHA1_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_224:
- ret = RTE_CRYPTO_AUTH_SHA224_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA224_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_256:
- ret = RTE_CRYPTO_AUTH_SHA256_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA256_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_384:
- ret = RTE_CRYPTO_AUTH_SHA384_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA384_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_512:
- ret = RTE_CRYPTO_AUTH_SHA512_HMAC;
- break;
- case VIRTIO_CRYPTO_MAC_CMAC_3DES:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = RTE_CRYPTO_AUTH_SHA512_HMAC;
break;
case VIRTIO_CRYPTO_MAC_CMAC_AES:
- ret = RTE_CRYPTO_AUTH_AES_CMAC;
+ *algo = RTE_CRYPTO_AUTH_AES_CMAC;
break;
case VIRTIO_CRYPTO_MAC_KASUMI_F9:
- ret = RTE_CRYPTO_AUTH_KASUMI_F9;
+ *algo = RTE_CRYPTO_AUTH_KASUMI_F9;
break;
case VIRTIO_CRYPTO_MAC_SNOW3G_UIA2:
- ret = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ *algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
break;
case VIRTIO_CRYPTO_MAC_GMAC_AES:
- ret = RTE_CRYPTO_AUTH_AES_GMAC;
- break;
- case VIRTIO_CRYPTO_MAC_GMAC_TWOFISH:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = RTE_CRYPTO_AUTH_AES_GMAC;
break;
case VIRTIO_CRYPTO_MAC_CBCMAC_AES:
- ret = RTE_CRYPTO_AUTH_AES_CBC_MAC;
- break;
- case VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = RTE_CRYPTO_AUTH_AES_CBC_MAC;
break;
case VIRTIO_CRYPTO_MAC_XCBC_AES:
- ret = RTE_CRYPTO_AUTH_AES_XCBC_MAC;
+ *algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC;
break;
+ case VIRTIO_CRYPTO_MAC_CMAC_3DES:
+ case VIRTIO_CRYPTO_MAC_GMAC_TWOFISH:
+ case VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9:
+ return -VIRTIO_CRYPTO_NOTSUPP;
default:
- ret = -VIRTIO_CRYPTO_BADMSG;
- break;
+ return -VIRTIO_CRYPTO_BADMSG;
}
- return ret;
+ return 0;
}
static int get_iv_len(enum rte_crypto_cipher_algorithm algo)
@@ -242,12 +233,11 @@ transform_cipher_param(struct rte_crypto_sym_xform *xform,
{
int ret;
- ret = cipher_algo_transform(param->cipher_algo);
+ ret = cipher_algo_transform(param->cipher_algo, &xform->cipher.algo);
if (unlikely(ret < 0))
return ret;
xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- 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;
@@ -293,11 +283,11 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
}
/* cipher */
- ret = cipher_algo_transform(param->cipher_algo);
+ ret = cipher_algo_transform(param->cipher_algo,
+ &xform_cipher->cipher.algo);
if (unlikely(ret < 0))
return ret;
xform_cipher->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- 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);
@@ -308,10 +298,9 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
/* auth */
xform_auth->type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ret = auth_algo_transform(param->hash_algo);
+ ret = auth_algo_transform(param->hash_algo, &xform_auth->auth.algo);
if (unlikely(ret < 0))
return 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;
--
2.14.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
2019-05-15 16:09 [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum Fan Zhang
@ 2019-05-15 16:09 ` Fan Zhang
2019-06-17 16:57 ` Kovacevic, Marko
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Fan Zhang @ 2019-05-15 16:09 UTC (permalink / raw)
To: dev; +Cc: maxime.coquelin, Fan Zhang, stable
This patch fixes the inferred misuse of enum of crypto
algorithms.
Coverity issue: 325879
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 | 93 ++++++++++++++++++-----------------------
1 file changed, 41 insertions(+), 52 deletions(-)
diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index 0edf12d52..b812661ef 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -46,116 +46,107 @@
((t)(uintptr_t)vhost_iova_to_vva(r->dev, r->vq, a, l, p))
static int
-cipher_algo_transform(uint32_t virtio_cipher_algo)
+cipher_algo_transform(uint32_t virtio_cipher_algo,
+ enum rte_crypto_cipher_algorithm *algo)
{
- int ret;
-
switch (virtio_cipher_algo) {
case VIRTIO_CRYPTO_CIPHER_AES_CBC:
- ret = RTE_CRYPTO_CIPHER_AES_CBC;
+ *algo = RTE_CRYPTO_CIPHER_AES_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_AES_CTR:
- ret = RTE_CRYPTO_CIPHER_AES_CTR;
+ *algo = RTE_CRYPTO_CIPHER_AES_CTR;
break;
case VIRTIO_CRYPTO_CIPHER_DES_ECB:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = -VIRTIO_CRYPTO_NOTSUPP;
break;
case VIRTIO_CRYPTO_CIPHER_DES_CBC:
- ret = RTE_CRYPTO_CIPHER_DES_CBC;
+ *algo = RTE_CRYPTO_CIPHER_DES_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_3DES_ECB:
- ret = RTE_CRYPTO_CIPHER_3DES_ECB;
+ *algo = RTE_CRYPTO_CIPHER_3DES_ECB;
break;
case VIRTIO_CRYPTO_CIPHER_3DES_CBC:
- ret = RTE_CRYPTO_CIPHER_3DES_CBC;
+ *algo = RTE_CRYPTO_CIPHER_3DES_CBC;
break;
case VIRTIO_CRYPTO_CIPHER_3DES_CTR:
- ret = RTE_CRYPTO_CIPHER_3DES_CTR;
+ *algo = RTE_CRYPTO_CIPHER_3DES_CTR;
break;
case VIRTIO_CRYPTO_CIPHER_KASUMI_F8:
- ret = RTE_CRYPTO_CIPHER_KASUMI_F8;
+ *algo = RTE_CRYPTO_CIPHER_KASUMI_F8;
break;
case VIRTIO_CRYPTO_CIPHER_SNOW3G_UEA2:
- ret = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
+ *algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2;
break;
case VIRTIO_CRYPTO_CIPHER_AES_F8:
- ret = RTE_CRYPTO_CIPHER_AES_F8;
+ *algo = RTE_CRYPTO_CIPHER_AES_F8;
break;
case VIRTIO_CRYPTO_CIPHER_AES_XTS:
- ret = RTE_CRYPTO_CIPHER_AES_XTS;
+ *algo = RTE_CRYPTO_CIPHER_AES_XTS;
break;
case VIRTIO_CRYPTO_CIPHER_ZUC_EEA3:
- ret = RTE_CRYPTO_CIPHER_ZUC_EEA3;
+ *algo = RTE_CRYPTO_CIPHER_ZUC_EEA3;
break;
default:
- ret = -VIRTIO_CRYPTO_BADMSG;
+ return -VIRTIO_CRYPTO_BADMSG;
break;
}
- return ret;
+ return 0;
}
static int
-auth_algo_transform(uint32_t virtio_auth_algo)
+auth_algo_transform(uint32_t virtio_auth_algo,
+ enum rte_crypto_auth_algorithm *algo)
{
- int ret;
-
switch (virtio_auth_algo) {
-
case VIRTIO_CRYPTO_NO_MAC:
- ret = RTE_CRYPTO_AUTH_NULL;
+ *algo = RTE_CRYPTO_AUTH_NULL;
break;
case VIRTIO_CRYPTO_MAC_HMAC_MD5:
- ret = RTE_CRYPTO_AUTH_MD5_HMAC;
+ *algo = RTE_CRYPTO_AUTH_MD5_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA1:
- ret = RTE_CRYPTO_AUTH_SHA1_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA1_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_224:
- ret = RTE_CRYPTO_AUTH_SHA224_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA224_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_256:
- ret = RTE_CRYPTO_AUTH_SHA256_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA256_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_384:
- ret = RTE_CRYPTO_AUTH_SHA384_HMAC;
+ *algo = RTE_CRYPTO_AUTH_SHA384_HMAC;
break;
case VIRTIO_CRYPTO_MAC_HMAC_SHA_512:
- ret = RTE_CRYPTO_AUTH_SHA512_HMAC;
- break;
- case VIRTIO_CRYPTO_MAC_CMAC_3DES:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = RTE_CRYPTO_AUTH_SHA512_HMAC;
break;
case VIRTIO_CRYPTO_MAC_CMAC_AES:
- ret = RTE_CRYPTO_AUTH_AES_CMAC;
+ *algo = RTE_CRYPTO_AUTH_AES_CMAC;
break;
case VIRTIO_CRYPTO_MAC_KASUMI_F9:
- ret = RTE_CRYPTO_AUTH_KASUMI_F9;
+ *algo = RTE_CRYPTO_AUTH_KASUMI_F9;
break;
case VIRTIO_CRYPTO_MAC_SNOW3G_UIA2:
- ret = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
+ *algo = RTE_CRYPTO_AUTH_SNOW3G_UIA2;
break;
case VIRTIO_CRYPTO_MAC_GMAC_AES:
- ret = RTE_CRYPTO_AUTH_AES_GMAC;
- break;
- case VIRTIO_CRYPTO_MAC_GMAC_TWOFISH:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = RTE_CRYPTO_AUTH_AES_GMAC;
break;
case VIRTIO_CRYPTO_MAC_CBCMAC_AES:
- ret = RTE_CRYPTO_AUTH_AES_CBC_MAC;
- break;
- case VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9:
- ret = -VIRTIO_CRYPTO_NOTSUPP;
+ *algo = RTE_CRYPTO_AUTH_AES_CBC_MAC;
break;
case VIRTIO_CRYPTO_MAC_XCBC_AES:
- ret = RTE_CRYPTO_AUTH_AES_XCBC_MAC;
+ *algo = RTE_CRYPTO_AUTH_AES_XCBC_MAC;
break;
+ case VIRTIO_CRYPTO_MAC_CMAC_3DES:
+ case VIRTIO_CRYPTO_MAC_GMAC_TWOFISH:
+ case VIRTIO_CRYPTO_MAC_CBCMAC_KASUMI_F9:
+ return -VIRTIO_CRYPTO_NOTSUPP;
default:
- ret = -VIRTIO_CRYPTO_BADMSG;
- break;
+ return -VIRTIO_CRYPTO_BADMSG;
}
- return ret;
+ return 0;
}
static int get_iv_len(enum rte_crypto_cipher_algorithm algo)
@@ -242,12 +233,11 @@ transform_cipher_param(struct rte_crypto_sym_xform *xform,
{
int ret;
- ret = cipher_algo_transform(param->cipher_algo);
+ ret = cipher_algo_transform(param->cipher_algo, &xform->cipher.algo);
if (unlikely(ret < 0))
return ret;
xform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- 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;
@@ -293,11 +283,11 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
}
/* cipher */
- ret = cipher_algo_transform(param->cipher_algo);
+ ret = cipher_algo_transform(param->cipher_algo,
+ &xform_cipher->cipher.algo);
if (unlikely(ret < 0))
return ret;
xform_cipher->type = RTE_CRYPTO_SYM_XFORM_CIPHER;
- 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);
@@ -308,10 +298,9 @@ transform_chain_param(struct rte_crypto_sym_xform *xforms,
/* auth */
xform_auth->type = RTE_CRYPTO_SYM_XFORM_AUTH;
- ret = auth_algo_transform(param->hash_algo);
+ ret = auth_algo_transform(param->hash_algo, &xform_auth->auth.algo);
if (unlikely(ret < 0))
return 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;
--
2.14.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
2019-05-15 16:09 [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum Fan Zhang
2019-05-15 16:09 ` Fan Zhang
@ 2019-06-17 16:57 ` Kovacevic, Marko
2019-06-20 9:47 ` Maxime Coquelin
2019-06-20 9:59 ` Maxime Coquelin
3 siblings, 0 replies; 6+ messages in thread
From: Kovacevic, Marko @ 2019-06-17 16:57 UTC (permalink / raw)
To: Zhang, Roy Fan, dev; +Cc: maxime.coquelin, Zhang, Roy Fan, stable
> Subject: [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
>
> This patch fixes the inferred misuse of enum of crypto algorithms.
>
> Coverity issue: 325879
> 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 | 93 ++++++++++++++++++--------------------
> ---
> 1 file changed, 41 insertions(+), 52 deletions(-)
>
> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
> index 0edf12d52..b812661ef 100644
> --- a/lib/librte_vhost/vhost_crypto.c
> +++ b/lib/librte_vhost/vhost_crypto.c
> @@ -46,116 +46,107 @@
> ((t)(uintptr_t)vhost_iova_to_vva(r->dev, r->vq, a, l, p))
<...>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
2019-05-15 16:09 [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum Fan Zhang
2019-05-15 16:09 ` Fan Zhang
2019-06-17 16:57 ` Kovacevic, Marko
@ 2019-06-20 9:47 ` Maxime Coquelin
2019-06-20 9:59 ` Maxime Coquelin
3 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2019-06-20 9:47 UTC (permalink / raw)
To: Fan Zhang, dev; +Cc: stable
On 5/15/19 6:09 PM, Fan Zhang wrote:
> This patch fixes the inferred misuse of enum of crypto
> algorithms.
>
> Coverity issue: 325879
> 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 | 93 ++++++++++++++++++-----------------------
> 1 file changed, 41 insertions(+), 52 deletions(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
2019-05-15 16:09 [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum Fan Zhang
` (2 preceding siblings ...)
2019-06-20 9:47 ` Maxime Coquelin
@ 2019-06-20 9:59 ` Maxime Coquelin
3 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2019-06-20 9:59 UTC (permalink / raw)
To: Fan Zhang, dev; +Cc: stable
On 5/15/19 6:09 PM, Fan Zhang wrote:
> This patch fixes the inferred misuse of enum of crypto
> algorithms.
>
> Coverity issue: 325879
> 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 | 93 ++++++++++++++++++-----------------------
> 1 file changed, 41 insertions(+), 52 deletions(-)
>
Applied to dpdk-next-virtio/master.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum
@ 2018-11-01 14:15 Fan Zhang
0 siblings, 0 replies; 6+ messages in thread
From: Fan Zhang @ 2018-11-01 14:15 UTC (permalink / raw)
To: dev; +Cc: maxime.coquelin, stable
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(-)
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;
--
2.13.6
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-20 10:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-15 16:09 [dpdk-dev] [PATCH] vhost/crypto: fix inferred misuse of enum Fan Zhang
2019-05-15 16:09 ` Fan Zhang
2019-06-17 16:57 ` Kovacevic, Marko
2019-06-20 9:47 ` Maxime Coquelin
2019-06-20 9:59 ` Maxime Coquelin
-- strict thread matches above, loose matches on Subject: below --
2018-11-01 14:15 Fan Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).