mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot for Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, hpa@zytor.com,
	mingo@redhat.com, lizf@cn.fujitsu.com,
	yanmin_zhang@linux.intel.com, stable@kernel.org,
	tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/core] perf record: Zero out mmap_array to fix segfault
Date: Fri, 26 Mar 2010 12:57:59 GMT	[thread overview]
Message-ID: <tip-5a10317483f606106395814ee2fdaa2f1256a3b3@git.kernel.org> (raw)
In-Reply-To: <1269557941-15617-6-git-send-email-acme@infradead.org>

Commit-ID:  5a10317483f606106395814ee2fdaa2f1256a3b3
Gitweb:     http://git.kernel.org/tip/5a10317483f606106395814ee2fdaa2f1256a3b3
Author:     Zhang, Yanmin <yanmin_zhang@linux.intel.com>
AuthorDate: Thu, 25 Mar 2010 19:59:01 -0300
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Fri, 26 Mar 2010 08:52:59 +0100

perf record: Zero out mmap_array to fix segfault

Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Tested-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Zhang Yanmin <yanmin_zhang@linux.intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1269557941-15617-6-git-send-email-acme@infradead.org>
Cc: <stable@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 tools/perf/builtin-record.c |    2 +-
 tools/perf/builtin-top.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index bb5b23d..60ecdd3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -751,7 +751,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used)
 	for (i = 0; i < MAX_NR_CPUS; i++) {
 		for (j = 0; j < MAX_COUNTERS; j++) {
 			fd[i][j] = malloc(sizeof(int)*thread_num);
-			mmap_array[i][j] = malloc(
+			mmap_array[i][j] = zalloc(
 				sizeof(struct mmap_data)*thread_num);
 			if (!fd[i][j] || !mmap_array[i][j])
 				return -ENOMEM;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 5f3ac9f..4abdd9b 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1371,7 +1371,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used)
 	for (i = 0; i < MAX_NR_CPUS; i++) {
 		for (j = 0; j < MAX_COUNTERS; j++) {
 			fd[i][j] = malloc(sizeof(int)*thread_num);
-			mmap_array[i][j] = malloc(
+			mmap_array[i][j] = zalloc(
 				sizeof(struct mmap_data)*thread_num);
 			if (!fd[i][j] || !mmap_array[i][j])
 				return -ENOMEM;

      reply	other threads:[~2010-03-26 12:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-25 22:58 [PATCH 1/6] perf newt: Initialize choice variable Arnaldo Carvalho de Melo
2010-03-25 22:58 ` [PATCH 2/6] perf symbols: Pass the mmap parameters instead of using mmap_event Arnaldo Carvalho de Melo
2010-03-25 22:58 ` [PATCH 3/6] perf symbols: Move map related routines to map.c Arnaldo Carvalho de Melo
2010-03-25 22:58 ` [PATCH 4/6] perf tools: Move __used from perf.h to linux/compiler.h Arnaldo Carvalho de Melo
2010-03-25 22:59 ` [PATCH 5/6] perf symbols: Move hex2u64 and strxfrchar to symbol.c Arnaldo Carvalho de Melo
2010-03-25 22:59 ` [PATCH 6/6] perf record: zero mmap_array[][][] fixing segfault Arnaldo Carvalho de Melo
2010-03-26 12:57   ` tip-bot for Zhang, Yanmin [this message]

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=tip-5a10317483f606106395814ee2fdaa2f1256a3b3@git.kernel.org \
    --to=yanmin_zhang@linux.intel.com \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=stable@kernel.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome