[PATCH] xfstests: aio-stress, use calloc for thread_info array

Jeff Mahoney jeffm at suse.com
Mon Jan 6 14:50:47 CST 2014


The thread_info array is assumed to be initialized to 0s, but
that causes a segfault when MALLOC_PERTURB_ is set.

Signed-off-by: Jeff Mahoney <jeffm at suse.com>
---

 ltp/aio-stress.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/ltp/aio-stress.c
+++ b/ltp/aio-stress.c
@@ -1413,9 +1413,9 @@ int main(int ac, char **av)
 	        num_threads);
     }

-    t = malloc(num_threads * sizeof(*t));
+    t = calloc(num_threads, sizeof(*t));
     if (!t) {
-        perror("malloc");
+        perror("calloc");
 	exit(1);
     }
     global_thread_info = t;


-- 
Jeff Mahoney
SUSE Labs



More information about the xfs mailing list