diff mbox series

test: fix division by zero

Message ID 1619163330-25960-1-git-send-email-humin29@huawei.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers show
Series test: fix division by zero | expand


Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/github-robot success github build: passed
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) April 23, 2021, 7:35 a.m. UTC
Variable i is used as a denominator which may be zero, and
this may result in segmentation fault.

This patch fixed it.

Fixes: 948bc3d6d095 ("test: add reciprocal based division")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
 app/test/test_reciprocal_division_perf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series


diff --git a/app/test/test_reciprocal_division_perf.c b/app/test/test_reciprocal_division_perf.c
index a7be8aa..2647308 100644
--- a/app/test/test_reciprocal_division_perf.c
+++ b/app/test/test_reciprocal_division_perf.c
@@ -143,7 +143,7 @@  test_reciprocal_division_perf(void)
 					"result %"PRIu64"",
 					nresult_u64, rresult_u64);
 			result = 1;
-			break;
+			goto err;
@@ -182,7 +182,7 @@  test_reciprocal_division_perf(void)
 					dividend_u64, divisor_u64,
 					nresult_u64, rresult_u64);
 			result = 1;
-			break;
+			goto err;
 	printf("64bit Division results:\n");
@@ -195,6 +195,7 @@  test_reciprocal_division_perf(void)
 	printf("Cycles per division(reciprocal) : %3.2f\n",
 	return result;