vhost/crypto: fix logically dead code

Message ID 20190515161948.70498-1-roy.fan.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost/crypto: fix logically dead code |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Fan Zhang May 15, 2019, 4:19 p.m. UTC
  This patch fixes a few same class bugs that causes the
logically dead code in vhost_crypto.

Coverity issue: 277236
Coverity issue: 277233
Coverity issue: 277220
Coverity issue: 277214

Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
Cc: stable@dpdk.org

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

Comments

Kovacevic, Marko June 17, 2019, 9:26 a.m. UTC | #1
> Subject: [dpdk-dev] [PATCH] vhost/crypto: fix logically dead code
> 
> This patch fixes a few same class bugs that causes the logically dead code in
> vhost_crypto.
> 
> Coverity issue: 277236
> Coverity issue: 277233
> Coverity issue: 277220
> Coverity issue: 277214
> 
> Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>  lib/librte_vhost/vhost_crypto.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
> index 0edf12d52..069b56108 100644
> --- a/lib/librte_vhost/vhost_crypto.c
> +++ b/lib/librte_vhost/vhost_crypto.c
> @@ -1024,7 +1024,7 @@ prepare_sym_chain_op(struct vhost_crypto
> *vcrypto, struct rte_crypto_op *op,
>  		}
>  		if (unlikely(copy_data(rte_pktmbuf_mtod(m_src, uint8_t *),
>  				vc_req, &desc, chain->para.src_data_len,
> -				nb_descs, vq_size)) < 0) {
> +				nb_descs, vq_size) < 0)) {
>  			ret = VIRTIO_CRYPTO_BADMSG;
>  			goto error_exit;
>  		}
> @@ -1598,7 +1598,7 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t
> qid,
>  			op->sym->m_dst->data_off = 0;
> 
>  			if (unlikely(vhost_crypto_process_one_req(vcrypto,
> vq,
> -					op, head, desc_idx)) < 0)
> +					op, head, desc_idx) < 0))
>  				break;
>  		}

Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
  
Maxime Coquelin June 20, 2019, 9:46 a.m. UTC | #2
On 5/15/19 6:19 PM, Fan Zhang wrote:
> This patch fixes a few same class bugs that causes the
> logically dead code in vhost_crypto.
> 
> Coverity issue: 277236
> Coverity issue: 277233
> Coverity issue: 277220
> Coverity issue: 277214
> 
> Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>   lib/librte_vhost/vhost_crypto.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
> index 0edf12d52..069b56108 100644
> --- a/lib/librte_vhost/vhost_crypto.c
> +++ b/lib/librte_vhost/vhost_crypto.c
> @@ -1024,7 +1024,7 @@ prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
>   		}
>   		if (unlikely(copy_data(rte_pktmbuf_mtod(m_src, uint8_t *),
>   				vc_req, &desc, chain->para.src_data_len,
> -				nb_descs, vq_size)) < 0) {
> +				nb_descs, vq_size) < 0)) {
>   			ret = VIRTIO_CRYPTO_BADMSG;
>   			goto error_exit;
>   		}
> @@ -1598,7 +1598,7 @@ rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
>   			op->sym->m_dst->data_off = 0;
>   
>   			if (unlikely(vhost_crypto_process_one_req(vcrypto, vq,
> -					op, head, desc_idx)) < 0)
> +					op, head, desc_idx) < 0))
>   				break;
>   		}
>   
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Maxime Coquelin June 20, 2019, 9:59 a.m. UTC | #3
On 5/15/19 6:19 PM, Fan Zhang wrote:
> This patch fixes a few same class bugs that causes the
> logically dead code in vhost_crypto.
> 
> Coverity issue: 277236
> Coverity issue: 277233
> Coverity issue: 277220
> Coverity issue: 277214
> 
> Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
> ---
>   lib/librte_vhost/vhost_crypto.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 

Applied to dpdk-next-virtio/master.

Thanks,
Maxime
  

Patch

diff --git a/lib/librte_vhost/vhost_crypto.c b/lib/librte_vhost/vhost_crypto.c
index 0edf12d52..069b56108 100644
--- a/lib/librte_vhost/vhost_crypto.c
+++ b/lib/librte_vhost/vhost_crypto.c
@@ -1024,7 +1024,7 @@  prepare_sym_chain_op(struct vhost_crypto *vcrypto, struct rte_crypto_op *op,
 		}
 		if (unlikely(copy_data(rte_pktmbuf_mtod(m_src, uint8_t *),
 				vc_req, &desc, chain->para.src_data_len,
-				nb_descs, vq_size)) < 0) {
+				nb_descs, vq_size) < 0)) {
 			ret = VIRTIO_CRYPTO_BADMSG;
 			goto error_exit;
 		}
@@ -1598,7 +1598,7 @@  rte_vhost_crypto_fetch_requests(int vid, uint32_t qid,
 			op->sym->m_dst->data_off = 0;
 
 			if (unlikely(vhost_crypto_process_one_req(vcrypto, vq,
-					op, head, desc_idx)) < 0)
+					op, head, desc_idx) < 0))
 				break;
 		}