Skip to contentSkip to conversation

lib/pipeline: fix logically dead code

PATCH Applied Fan Zhang 2 participants 2 messages Nov 5, 2018 – Nov 12, 2018

lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

PATCH 1/1 lib/pipeline: fix logically dead code

This patches fixes the coverity issue of logically dead code.

Fixes 96303217a606 ("pipeline: add symmetric crypto table action")

Coverity issue: 323523

---
 lib/librte_pipeline/rte_table_action.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/librte_pipeline/rte_table_action.c +2 -3
index 537e6593e..7c7c8dd82 100644
@@ -1694,10 +1694,9 @@ get_block_size(const struct rte_crypto_sym_xform *xform, uint8_t cdev_id)
 
 	rte_cryptodev_info_get(cdev_id, &dev_info);
 
-	for (i = 0;; i++) {
+	for (i = 0; dev_info.capabilities[i].op != RTE_CRYPTO_OP_TYPE_UNDEFINED;
+			i++) {
 		cap = &dev_info.capabilities[i];
-		if (!cap)
-			break;
 
 		if (cap->sym.xform_type != xform->type)
 			continue;
Signature · 1 line
2.13.6
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 40 lines

-----Original Message-----
From: Zhang, Roy Fan
Sent: Monday, November 5, 2018 12:27 PM
To: [email protected]
Cc: Dumitrescu, Cristian <[email protected]>
Subject: [PATCH] lib/pipeline: fix logically dead code

This patches fixes the coverity issue of logically dead code.

Fixes 96303217a606 ("pipeline: add symmetric crypto table action")

Coverity issue: 323523

---
 lib/librte_pipeline/rte_table_action.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/librte_pipeline/rte_table_action.c +2 -3
index 537e6593e..7c7c8dd82 100644
@@ -1694,10 +1694,9 @@ get_block_size(const struct
 rte_crypto_sym_xform *xform, uint8_t cdev_id)
 
 	rte_cryptodev_info_get(cdev_id, &dev_info);
 
-	for (i = 0;; i++) {
+	for (i = 0; dev_info.capabilities[i].op !=
 RTE_CRYPTO_OP_TYPE_UNDEFINED;
+			i++) {
 		cap = &dev_info.capabilities[i];
-		if (!cap)
-			break;
 
lib/librte_pipeline/rte_table_action.c +0 -1
 		if (cap->sym.xform_type != xform->type)
 			continue;
--
Quoted 1 line

2.13.6

Applied to next-pipeline tree, thanks!