DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/timer: fix memzone reserve failure check
@ 2021-04-22  9:18 Min Hu (Connor)
  2021-05-01 20:00 ` Carrillo, Erik G
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Min Hu (Connor) @ 2021-04-22  9:18 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, rsanford, erik.g.carrillo

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>
---
 app/test/test_timer_secondary.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/app/test/test_timer_secondary.c b/app/test/test_timer_secondary.c
index 1e8f1d4..281f5bd 100644
--- a/app/test/test_timer_secondary.c
+++ b/app/test/test_timer_secondary.c
@@ -125,6 +125,11 @@ test_timer_secondary(void)
 
 		mz = rte_memzone_reserve(TEST_INFO_MZ_NAME, sizeof(*test_info),
 					 SOCKET_ID_ANY, 0);
+		if (mz == NULL) {
+			printf("Failed to reserve memzone\n");
+			return TEST_SKIPPED;
+		}
+
 		test_info = mz->addr;
 		TEST_ASSERT_NOT_NULL(test_info, "Couldn't allocate memory for "
 				     "test data");
@@ -171,6 +176,11 @@ test_timer_secondary(void)
 		int i;
 
 		mz = rte_memzone_lookup(TEST_INFO_MZ_NAME);
+		if (mz == NULL) {
+			printf("Failed to lookup memzone\n");
+			return TEST_SKIPPED;
+		}
+
 		test_info = mz->addr;
 		TEST_ASSERT_NOT_NULL(test_info, "Couldn't lookup memzone for "
 				     "test info");
-- 
2.7.4


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-05-13  0:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22  9:18 [dpdk-dev] [PATCH] test/timer: fix memzone reserve failure check Min Hu (Connor)
2021-05-01 20:00 ` Carrillo, Erik G
2021-05-04  1:08   ` Min Hu (Connor)
2021-05-04  1:07 ` [dpdk-dev] [PATCH v2] " Min Hu (Connor)
2021-05-04  1:18   ` Carrillo, Erik G
2021-05-10 14:13   ` Thomas Monjalon
2021-05-11  0:53     ` Min Hu (Connor)
2021-05-11  0:53 ` [dpdk-dev] [PATCH v3] " Min Hu (Connor)
2021-05-12 14:36   ` Thomas Monjalon
2021-05-13  0:19     ` Min Hu (Connor)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).