xfs
[Top] [All Lists]

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

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfstests: aio-stress, use calloc for thread_info array
From: Jeff Mahoney <jeffm@xxxxxxxx>
Date: Mon, 06 Jan 2014 15:50:47 -0500
Cc: dchinner@xxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0
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@xxxxxxxx>
---

 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

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] xfstests: aio-stress, use calloc for thread_info array, Jeff Mahoney <=