[v3,2/2] test/hash: fix coverity warning

Message ID 20221110151334.1448727-1-vladimir.medvedkin@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series None |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS

Commit Message

Vladimir Medvedkin Nov. 10, 2022, 3:13 p.m. UTC
  Check return value after bulk lookup

Coverity issue: 357746
Fixes: 14b8ab576235 ("hash: add bulk lookup with signatures array")
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
---
 app/test/test_hash_perf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson Nov. 10, 2022, 3:21 p.m. UTC | #1
On Thu, Nov 10, 2022 at 03:13:34PM +0000, Vladimir Medvedkin wrote:
> Check return value after bulk lookup
> 
> Coverity issue: 357746
> Fixes: 14b8ab576235 ("hash: add bulk lookup with signatures array")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c
index 5d36c0f454..1a90acd1ba 100644
--- a/app/test/test_hash_perf.c
+++ b/app/test/test_hash_perf.c
@@ -475,6 +475,10 @@  timed_lookups_multi(unsigned int with_hash, unsigned int with_data,
 					(const void **)keys_burst,
 					&signatures[j * BURST_SIZE],
 					BURST_SIZE, positions_burst);
+				if (ret != 0) {
+					printf("rte_hash_lookup_with_hash_bulk failed with %d\n", ret);
+					return -1;
+				}
 				for (k = 0; k < BURST_SIZE; k++) {
 					if (positions_burst[k] !=
 							positions[j *
@@ -487,10 +491,14 @@  timed_lookups_multi(unsigned int with_hash, unsigned int with_data,
 					}
 				}
 			} else {
-				rte_hash_lookup_bulk(h[table_index],
+				ret = rte_hash_lookup_bulk(h[table_index],
 						(const void **) keys_burst,
 						BURST_SIZE,
 						positions_burst);
+				if (ret != 0) {
+					printf("rte_hash_lookup_bulk failed with %d\n", ret);
+					return -1;
+				}
 				for (k = 0; k < BURST_SIZE; k++) {
 					if (positions_burst[k] != positions[j * BURST_SIZE + k]) {
 						printf("Key looked up in %d, should be in %d\n",