From: Amr Mokhtar Date: Wed, 31 Jan 2018 14:40:25 +0000 (+0000) Subject: examples/bbdev: fix unchecked return of stats X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=200d0e7a708c8a99e1e4b8fe98d56f368d3b6187;p=dpdk.git examples/bbdev: fix unchecked return of stats 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 --- diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index e779db2819..3c45256954 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -616,8 +616,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);