diff mbox series

[v3] test/timer: fix memzone reserve failure check

Message ID 1620694399-20825-1-git-send-email-humin29@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series [v3] test/timer: fix memzone reserve failure check | expand

Checks

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

Commit Message

Min Hu (Connor) May 11, 2021, 12:53 a.m. UTC
Segmentation fault may occur without checking if memzone
reserves succeed or not.

This patch fixed it.

Fixes: 50247fe03fe0 ("test/timer: exercise new APIs in secondary process")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
v3:
* do not split error messages.

v2:
* use TEST_ASSERT_NOT_NULL check "mz" instead of checking
  the test_info pointer.
---
 app/test/test_timer_secondary.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Thomas Monjalon May 12, 2021, 2:36 p.m. UTC | #1
11/05/2021 02:53, Min Hu (Connor):
> Segmentation fault may occur without checking if memzone
> reserves succeed or not.
> 
> This patch fixed it.
> 
> Fixes: 50247fe03fe0 ("test/timer: exercise new APIs in secondary process")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>

You missed reporting previous ack:
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>

Applied, thanks

PS: please do not forget marking old patches as superseded
when sending a new version.
Min Hu (Connor) May 13, 2021, 12:19 a.m. UTC | #2
在 2021/5/12 22:36, Thomas Monjalon 写道:
> 11/05/2021 02:53, Min Hu (Connor):
>> Segmentation fault may occur without checking if memzone
>> reserves succeed or not.
>>
>> This patch fixed it.
>>
>> Fixes: 50247fe03fe0 ("test/timer: exercise new APIs in secondary process")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> 
> You missed reporting previous ack:
> Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
> 
> Applied, thanks
> 
> PS: please do not forget marking old patches as superseded
> when sending a new version.
Got it, thanks.
> 
> 
> .
>
diff mbox series

Patch

diff --git a/app/test/test_timer_secondary.c b/app/test/test_timer_secondary.c
index 1e8f1d4..decfaef 100644
--- a/app/test/test_timer_secondary.c
+++ b/app/test/test_timer_secondary.c
@@ -125,9 +125,8 @@  test_timer_secondary(void)
 
 		mz = rte_memzone_reserve(TEST_INFO_MZ_NAME, sizeof(*test_info),
 					 SOCKET_ID_ANY, 0);
+		TEST_ASSERT_NOT_NULL(mz, "Couldn't allocate memory for test data");
 		test_info = mz->addr;
-		TEST_ASSERT_NOT_NULL(test_info, "Couldn't allocate memory for "
-				     "test data");
 
 		test_info->tim_mempool = rte_mempool_create("test_timer_mp",
 				NUM_TIMERS, sizeof(struct rte_timer), 0, 0,
@@ -171,9 +170,8 @@  test_timer_secondary(void)
 		int i;
 
 		mz = rte_memzone_lookup(TEST_INFO_MZ_NAME);
+		TEST_ASSERT_NOT_NULL(mz, "Couldn't lookup memzone for test info");
 		test_info = mz->addr;
-		TEST_ASSERT_NOT_NULL(test_info, "Couldn't lookup memzone for "
-				     "test info");
 
 		for (i = 0; i < NUM_TIMERS; i++) {
 			rte_mempool_get(test_info->tim_mempool, (void **)&tim);