* [dpdk-dev] [PATCH 1/1] examples/distributor: fix unchecked return value
@ 2016-04-19 12:31 Marcin Kerlin
2016-05-09 15:36 ` Pattan, Reshma
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Kerlin @ 2016-04-19 12:31 UTC (permalink / raw)
To: dev; +Cc: bruce.richardson, reshma.pattan, Marcin Kerlin
Fix issue reported by Coverity.
Coverity ID 13207:
Value returned from a function is not checked for errors before being
used.
Fixes: 07db4a975094 ("examples/distributor: new sample app")
Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
---
examples/distributor/main.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/examples/distributor/main.c b/examples/distributor/main.c
index c0201a9..8238520 100644
--- a/examples/distributor/main.c
+++ b/examples/distributor/main.c
@@ -178,19 +178,25 @@ struct lcore_params {
struct rte_mempool *mem_pool;
};
-static void
+static int
quit_workers(struct rte_distributor *d, struct rte_mempool *p)
{
const unsigned num_workers = rte_lcore_count() - 2;
unsigned i;
struct rte_mbuf *bufs[num_workers];
- rte_mempool_get_bulk(p, (void *)bufs, num_workers);
+
+ if (rte_mempool_get_bulk(p, (void *)bufs, num_workers) != 0) {
+ printf("line %d: Error getting mbufs from pool\n", __LINE__);
+ return -1;
+ }
for (i = 0; i < num_workers; i++)
bufs[i]->hash.rss = i << 1;
rte_distributor_process(d, bufs, num_workers);
rte_mempool_put_bulk(p, (void *)bufs, num_workers);
+
+ return 0;
}
static int
@@ -258,7 +264,8 @@ lcore_rx(struct lcore_params *p)
* get packets till quit_signal is actually been
* received and they gracefully shutdown
*/
- quit_workers(d, mem_pool);
+ if (quit_workers(d, mem_pool) != 0)
+ return -1;
/* rx thread should quit at last */
return 0;
}
@@ -588,7 +595,9 @@ main(int argc, char *argv[])
}
/* call lcore_main on master core only */
struct lcore_params p = { 0, d, output_ring, mbuf_pool};
- lcore_rx(&p);
+
+ if (lcore_rx(&p) != 0)
+ return -1;
RTE_LCORE_FOREACH_SLAVE(lcore_id) {
if (rte_eal_wait_lcore(lcore_id) < 0)
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] examples/distributor: fix unchecked return value
2016-04-19 12:31 [dpdk-dev] [PATCH 1/1] examples/distributor: fix unchecked return value Marcin Kerlin
@ 2016-05-09 15:36 ` Pattan, Reshma
2016-05-16 17:25 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Pattan, Reshma @ 2016-05-09 15:36 UTC (permalink / raw)
To: Kerlin, MarcinX, dev; +Cc: Richardson, Bruce
> -----Original Message-----
> From: Kerlin, MarcinX
> Sent: Tuesday, April 19, 2016 1:32 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; Kerlin, MarcinX <marcinx.kerlin@intel.com>
> Subject: [PATCH 1/1] examples/distributor: fix unchecked return value
>
> Fix issue reported by Coverity.
>
> Coverity ID 13207:
> Value returned from a function is not checked for errors before being used.
>
> Fixes: 07db4a975094 ("examples/distributor: new sample app")
>
> Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
> ---
> examples/distributor/main.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH 1/1] examples/distributor: fix unchecked return value
2016-05-09 15:36 ` Pattan, Reshma
@ 2016-05-16 17:25 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-05-16 17:25 UTC (permalink / raw)
To: Kerlin, MarcinX; +Cc: dev, Pattan, Reshma, Richardson, Bruce
> > Fix issue reported by Coverity.
> >
> > Coverity ID 13207:
> > Value returned from a function is not checked for errors before being used.
> >
> > Fixes: 07db4a975094 ("examples/distributor: new sample app")
> >
> > Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
>
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-16 17:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-19 12:31 [dpdk-dev] [PATCH 1/1] examples/distributor: fix unchecked return value Marcin Kerlin
2016-05-09 15:36 ` Pattan, Reshma
2016-05-16 17:25 ` Thomas Monjalon
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).