From 705b04af1c100c464b6d9238408e84cfeffc489c Mon Sep 17 00:00:00 2001 From: "Min Hu (Connor)" Date: Thu, 22 Apr 2021 14:13:54 +0800 Subject: [PATCH] test: check flow classifier creation 'cls->cls' will be NULL if flow classifier create has failed, then segmentation fault will occur if the variable is used. This patch fixed it. Fixes: 9c9befea4f57 ("test: add flow classify unit tests") Cc: stable@dpdk.org Signed-off-by: Min Hu (Connor) Acked-by: Bernard Iremonger --- app/test/test_flow_classify.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test/test_flow_classify.c b/app/test/test_flow_classify.c index ef0b6fdd5c..951606f248 100644 --- a/app/test/test_flow_classify.c +++ b/app/test/test_flow_classify.c @@ -828,6 +828,12 @@ test_flow_classify(void) cls_params.name = "flow_classifier"; cls_params.socket_id = 0; cls->cls = rte_flow_classifier_create(&cls_params); + if (cls->cls == NULL) { + printf("Line %i: flow classifier create has failed!\n", + __LINE__); + rte_free(cls); + return TEST_FAILED; + } /* initialise ACL table params */ table_acl_params.n_rule_fields = RTE_DIM(ipv4_defs); -- 2.20.1