* [dpdk-dev] [PATCH] examples/performance-thread: fix return check
@ 2017-10-12 11:44 Jacek Piasecki
2017-10-13 11:56 ` Jastrzebski, MichalX K
0 siblings, 1 reply; 3+ messages in thread
From: Jacek Piasecki @ 2017-10-12 11:44 UTC (permalink / raw)
To: dev
Cc: bruce.richardson, harry.van.haaren, john.mcnamara,
Jacek Piasecki, ian.betts, stable
There was a call for thread create function without result check.
Added result check and message printout after failure.
Coverity issue: 143441
Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim app")
Cc: ian.betts@intel.com
Cc: stable@dpdk.org
Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
---
examples/performance-thread/pthread_shim/main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index 850b009..febae39 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -161,6 +161,7 @@ static void initial_lthread(void *args __attribute__((unused)))
pthread_override_set(1);
uint64_t i;
+ int ret;
/* initialize mutex for shared counter */
print_count = 0;
@@ -187,7 +188,10 @@ static void initial_lthread(void *args __attribute__((unused)))
pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t), &cpuset);
/* create the thread */
- pthread_create(&tid[i], &attr, helloworld_pthread, (void *) i);
+ ret = pthread_create(&tid[i], &attr,
+ helloworld_pthread, (void *) i);
+ if (ret != 0)
+ rte_exit(EXIT_FAILURE, "Cannot create helloworld thread\n");
}
/* wait for 1s to allow threads
--
1.9.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] examples/performance-thread: fix return check
2017-10-12 11:44 [dpdk-dev] [PATCH] examples/performance-thread: fix return check Jacek Piasecki
@ 2017-10-13 11:56 ` Jastrzebski, MichalX K
2017-10-13 23:07 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Jastrzebski, MichalX K @ 2017-10-13 11:56 UTC (permalink / raw)
To: Piasecki, JacekX, dev
Cc: Richardson, Bruce, Van Haaren, Harry, Mcnamara, John, Piasecki,
JacekX, ian.betts, stable
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jacek Piasecki
> Sent: Thursday, October 12, 2017 1:45 PM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>; Piasecki, JacekX
> <jacekx.piasecki@intel.com>; ian.betts@intel.com; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] examples/performance-thread: fix return check
>
> There was a call for thread create function without result check.
> Added result check and message printout after failure.
>
> Coverity issue: 143441
> Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim
> app")
> Cc: ian.betts@intel.com
> Cc: stable@dpdk.org
>
> Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
> ---
> examples/performance-thread/pthread_shim/main.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/examples/performance-thread/pthread_shim/main.c
> b/examples/performance-thread/pthread_shim/main.c
> index 850b009..febae39 100644
> --- a/examples/performance-thread/pthread_shim/main.c
> +++ b/examples/performance-thread/pthread_shim/main.c
> @@ -161,6 +161,7 @@ static void initial_lthread(void *args
> __attribute__((unused)))
> pthread_override_set(1);
>
> uint64_t i;
> + int ret;
>
> /* initialize mutex for shared counter */
> print_count = 0;
> @@ -187,7 +188,10 @@ static void initial_lthread(void *args
> __attribute__((unused)))
> pthread_attr_setaffinity_np(&attr, sizeof(rte_cpuset_t),
> &cpuset);
>
> /* create the thread */
> - pthread_create(&tid[i], &attr, helloworld_pthread, (void *)
> i);
> + ret = pthread_create(&tid[i], &attr,
> + helloworld_pthread, (void *) i);
> + if (ret != 0)
> + rte_exit(EXIT_FAILURE, "Cannot create helloworld
> thread\n");
> }
>
> /* wait for 1s to allow threads
> --
> 1.9.1
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] examples/performance-thread: fix return check
2017-10-13 11:56 ` Jastrzebski, MichalX K
@ 2017-10-13 23:07 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-10-13 23:07 UTC (permalink / raw)
To: Piasecki, JacekX
Cc: Jastrzebski, MichalX K, dev, Richardson, Bruce, Van Haaren,
Harry, Mcnamara, John, ian.betts
> > There was a call for thread create function without result check.
> > Added result check and message printout after failure.
> >
> > Coverity issue: 143441
> > Fixes: 433ba6228f9a ("examples/performance-thread: add pthread_shim
> > app")
> > Cc: ian.betts@intel.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
>
> Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-13 23:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 11:44 [dpdk-dev] [PATCH] examples/performance-thread: fix return check Jacek Piasecki
2017-10-13 11:56 ` Jastrzebski, MichalX K
2017-10-13 23:07 ` [dpdk-dev] [dpdk-stable] " 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).