All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Mahoney <jeffm@suse.com>
To: xfs@oss.sgi.com
Cc: dchinner@redhat.com
Subject: [PATCH] xfstests: aio-stress, use calloc for thread_info array
Date: Mon, 06 Jan 2014 15:50:47 -0500	[thread overview]
Message-ID: <52CB1727.3050109@suse.com> (raw)

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@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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

                 reply	other threads:[~2014-01-06 20:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CB1727.3050109@suse.com \
    --to=jeffm@suse.com \
    --cc=dchinner@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.