diff options
author | Zhang, Yanmin <yanmin_zhang@linux.intel.com> | 2010-03-25 18:59:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-26 03:52:59 -0400 |
commit | 5a10317483f606106395814ee2fdaa2f1256a3b3 (patch) | |
tree | 34b5258334dface9664ef24eee5ed94c6c8a165b /tools | |
parent | 5aab621b7bf024608f0c089e21656e7fe875a150 (diff) |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 2 | ||||
-rw-r--r-- | 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 bb5b23db4239..60ecdd3dd26d 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) | |||
751 | for (i = 0; i < MAX_NR_CPUS; i++) { | 751 | for (i = 0; i < MAX_NR_CPUS; i++) { |
752 | for (j = 0; j < MAX_COUNTERS; j++) { | 752 | for (j = 0; j < MAX_COUNTERS; j++) { |
753 | fd[i][j] = malloc(sizeof(int)*thread_num); | 753 | fd[i][j] = malloc(sizeof(int)*thread_num); |
754 | mmap_array[i][j] = malloc( | 754 | mmap_array[i][j] = zalloc( |
755 | sizeof(struct mmap_data)*thread_num); | 755 | sizeof(struct mmap_data)*thread_num); |
756 | if (!fd[i][j] || !mmap_array[i][j]) | 756 | if (!fd[i][j] || !mmap_array[i][j]) |
757 | return -ENOMEM; | 757 | return -ENOMEM; |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 5f3ac9ff354d..4abdd9b646b3 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) | |||
1371 | for (i = 0; i < MAX_NR_CPUS; i++) { | 1371 | for (i = 0; i < MAX_NR_CPUS; i++) { |
1372 | for (j = 0; j < MAX_COUNTERS; j++) { | 1372 | for (j = 0; j < MAX_COUNTERS; j++) { |
1373 | fd[i][j] = malloc(sizeof(int)*thread_num); | 1373 | fd[i][j] = malloc(sizeof(int)*thread_num); |
1374 | mmap_array[i][j] = malloc( | 1374 | mmap_array[i][j] = zalloc( |
1375 | sizeof(struct mmap_data)*thread_num); | 1375 | sizeof(struct mmap_data)*thread_num); |
1376 | if (!fd[i][j] || !mmap_array[i][j]) | 1376 | if (!fd[i][j] || !mmap_array[i][j]) |
1377 | return -ENOMEM; | 1377 | return -ENOMEM; |