xfs
[Top] [All Lists]

[PATCH] xfstests: aio-stress is calling pthread_join incorrectly

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfstests: aio-stress is calling pthread_join incorrectly
From: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>
Date: Tue, 18 Jun 2013 17:57:00 -0500
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
The retval parameter to pthread_join() is a pointer to a pointer.
aio-stress is passing in a pointer to an int. This can result in a bus
error on sparc64 when the pointer is not aligned on a 64-bit boundary.
Since the return value is not used, it is simplest to pass a NULL
pointer instead.

This has been fixed in the LTP source:
https://github.com/linux-test-project/ltp/commit/981d33aad3b33c4625b88990fbf2fad5470d47e0

Signed-off-by: Dave Kleikamp <dave.kleikamp@xxxxxxxxxx>
---

diff -up xfstests/ltp/aio-stress.c.orig xfstests/ltp/aio-stress.c
--- xfstests/ltp/aio-stress.c.orig      2013-06-03 11:53:49.000000000 -0700
+++ xfstests/ltp/aio-stress.c   2013-06-18 15:04:35.593859720 -0700
@@ -1210,7 +1210,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++) {
@@ -1221,7 +1220,7 @@ int run_workers(struct thread_info *t, i
        }
     }
     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);

<Prev in Thread] Current Thread [Next in Thread>