Skip to contentSkip to conversation

xfstests: aio-stress, use calloc for thread_info array

PATCH New Jeff Mahoney 1 participant 1 message Jan 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfstests: aio-stress, use calloc for thread_info array

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

---

 ltp/aio-stress.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ltp/aio-stress.c +2 -2
@@ -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;
Signature · 7 lines
Jeff Mahoney
SUSE Labs

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs