[Ocfs2-test-devel] [PATCH 43/59] aio-stress: fix invalid parameter to pthread_join
Junxiao Bi
junxiao.bi at oracle.com
Sun Sep 13 19:44:29 PDT 2015
The second parameter of pthread_join "value_ptr" has type "void **",
but "void *" is passed in, if pthread_join access "**value_ptr", it
will wrote into the value pointed by the content of "thread_ret" which
is a random value and may cause segment fault. Since "thread_ret" is not
used, so set the parameter to NULL.
Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
programs/aio-stress/aio-stress.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/programs/aio-stress/aio-stress.c b/programs/aio-stress/aio-stress.c
index 91af264..112ecf9 100644
--- a/programs/aio-stress/aio-stress.c
+++ b/programs/aio-stress/aio-stress.c
@@ -1213,7 +1213,6 @@ typedef void * (*start_routine)(void *);
int run_workers(struct thread_info *t, int num_threads)
{
int ret;
- int thread_ret;
int i;
for(i = 0 ; i < num_threads ; i++) {
@@ -1224,7 +1223,7 @@ int run_workers(struct thread_info *t, int num_threads)
}
}
for(i = 0 ; i < num_threads ; i++) {
- ret = pthread_join(t[i].tid, (void *)&thread_ret);
+ ret = pthread_join(t[i].tid, NULL);
if (ret) {
perror("pthread_join");
exit(1);
--
1.7.9.5
More information about the Ocfs2-test-devel
mailing list