From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 319FD9E7 for ; Wed, 29 Jun 2016 14:14:47 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 29 Jun 2016 05:14:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,546,1459839600"; d="scan'208";a="997290983" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga001.fm.intel.com with SMTP; 29 Jun 2016 05:14:44 -0700 Received: by Sent (sSMTP sendmail emulation); Wed, 29 Jun 2016 15:15:53 +0200 From: Piotr Azarewicz To: declan.doherty@intel.com Cc: dev@dpdk.org, Piotr Azarewicz Date: Wed, 29 Jun 2016 15:15:38 +0200 Message-Id: <1467206138-153175-1-git-send-email-piotrx.t.azarewicz@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v1 1/1] examples/bond: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2016 12:14:47 -0000 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 --- 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