From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 5D22B1B7BE for ; Wed, 31 Jan 2018 15:40:34 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2018 06:40:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,440,1511856000"; d="scan'208";a="26208271" Received: from silpixa00391537.ir.intel.com (HELO silpixa00391537.ger.corp.intel.com) ([10.237.222.189]) by fmsmga004.fm.intel.com with ESMTP; 31 Jan 2018 06:40:31 -0800 From: Amr Mokhtar To: dev@dpdk.org Cc: Amr Mokhtar Date: Wed, 31 Jan 2018 14:40:25 +0000 Message-Id: <1517409625-131498-1-git-send-email-amr.mokhtar@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] examples/bbdev: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Jan 2018 14:40:34 -0000 Added a check on rte_bbdev_stats_get() return before printing out the statistics results. Coverity issue: 257018 Fixes: 1ffee690eaa1 ("examples/bbdev: add sample app") Signed-off-by: Amr Mokhtar --- examples/bbdev_app/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 2e5bd8c..2af3562 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -609,8 +609,16 @@ print_stats(struct stats_lcore_params *stats_lcore) xstats[i].value); } + ret = rte_bbdev_stats_get(bbdev_id, &bbstats); + if (ret < 0) { + free(xstats); + free(xstats_names); + rte_exit(EXIT_FAILURE, + "ERROR(%d): Failure to get BBDEV %u statistics\n", + ret, bbdev_id); + } + printf("\nBBDEV STATISTICS:\n=================\n"); - rte_bbdev_stats_get(bbdev_id, &bbstats); printf("BBDEV %u: %s enqueue count:\t\t%"PRIu64"\n", bbdev_id, stats_border, bbstats.enqueued_count); -- 2.7.4