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 627E128BF for ; Thu, 30 Jun 2016 11:18:39 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 30 Jun 2016 02:18:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,551,1459839600"; d="scan'208";a="1012645539" Received: from dwdohert-dpdk.ir.intel.com ([163.33.210.152]) by fmsmga002.fm.intel.com with ESMTP; 30 Jun 2016 02:18:37 -0700 To: ptazarex@ecsmtp.igk.intel.com References: <1467192217-182940-1-git-send-email-piotrx.t.azarewicz@intel.com> Cc: dev@dpdk.org, Piotr Azarewicz From: Declan Doherty Message-ID: <4ea6fad1-ff5d-ff73-3200-7e92a7b92481@intel.com> Date: Thu, 30 Jun 2016 10:13:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <1467192217-182940-1-git-send-email-piotrx.t.azarewicz@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [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: Thu, 30 Jun 2016 09:18:39 -0000 On 29/06/16 10:23, ptazarex@ecsmtp.igk.intel.com wrote: > 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); > } > Acked-by: Declan Doherty