From: Jeff Mahoney Date: Mon, 20 Jan 2014 02:28:27 +0000 (+1100) Subject: aio-stress: use calloc for thread_info array X-Git-Tag: v2022.05.01~3296 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=99b3a9ab2a0906363706e26cf3be0780908d299a;p=users%2Fhch%2Fxfstests-dev.git 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. Signed-off-by: Jeff Mahoney Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/ltp/aio-stress.c b/ltp/aio-stress.c index ebff1bd42..d08843a8a 100644 --- 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;