DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 1/1] examples/bond: fix unchecked return value
@ 2016-06-29 13:15 Piotr Azarewicz
  2016-06-30 10:46 ` Azarewicz, PiotrX T
  0 siblings, 1 reply; 4+ messages in thread
From: Piotr Azarewicz @ 2016-06-29 13:15 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Piotr Azarewicz

The example is calling rte_eal_wait_lcore without checking return value.
Now it is fixed by checking the value and print proper message.

Coverity issue: 37789
Coverity issue: 37790
Fixes: cc7e8ae84faa ("examples/bond: add example application for link bonding mode 6")

Signed-off-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
---
 examples/bond/main.c |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 53bd044..776fad0 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -590,10 +590,14 @@ static void cmd_stop_parsed(__attribute__((unused)) void *parsed_result,
 		return;
 	}
 	global_flag_stru_p->LcoreMainIsRunning = 0;
-	rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
-	cmdline_printf(cl,
-			"lcore_main stopped on core:%d\n",
-			global_flag_stru_p->LcoreMainCore);
+	if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+		cmdline_printf(cl,
+				"error: lcore_main can not stop on core:%d\n",
+				global_flag_stru_p->LcoreMainCore);
+	else
+		cmdline_printf(cl,
+				"lcore_main stopped on core:%d\n",
+				global_flag_stru_p->LcoreMainCore);
 	rte_spinlock_unlock(&global_flag_stru_p->lock);
 }
 
@@ -628,10 +632,14 @@ static void cmd_quit_parsed(__attribute__((unused)) void *parsed_result,
 		return;
 	}
 	global_flag_stru_p->LcoreMainIsRunning = 0;
-	rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore);
-	cmdline_printf(cl,
-			"lcore_main stopped on core:%d\n",
-			global_flag_stru_p->LcoreMainCore);
+	if (rte_eal_wait_lcore(global_flag_stru_p->LcoreMainCore) < 0)
+		cmdline_printf(cl,
+				"error: lcore_main can not stop on core:%d\n",
+				global_flag_stru_p->LcoreMainCore);
+	else
+		cmdline_printf(cl,
+				"lcore_main stopped on core:%d\n",
+				global_flag_stru_p->LcoreMainCore);
 	rte_spinlock_unlock(&global_flag_stru_p->lock);
 	cmdline_quit(cl);
 }
-- 
1.7.9.5

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

end of thread, other threads:[~2016-07-11 14:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1467192217-182940-1-git-send-email-piotrx.t.azarewicz@intel.com>
2016-06-30  9:13 ` [dpdk-dev] [PATCH v1 1/1] examples/bond: fix unchecked return value Declan Doherty
2016-07-11 14:21   ` Thomas Monjalon
2016-06-29 13:15 Piotr Azarewicz
2016-06-30 10:46 ` Azarewicz, PiotrX T

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).