Commit 5a103174 authored by Zhang, Yanmin's avatar Zhang, Yanmin Committed by Ingo Molnar

perf record: Zero out mmap_array to fix segfault

Reported-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Tested-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarZhang Yanmin <yanmin_zhang@linux.intel.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1269557941-15617-6-git-send-email-acme@infradead.org>
Cc: <stable@kernel.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 5aab621b
...@@ -751,7 +751,7 @@ int cmd_record(int argc, const char **argv, const char *prefix __used) ...@@ -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 (i = 0; i < MAX_NR_CPUS; i++) {
for (j = 0; j < MAX_COUNTERS; j++) { for (j = 0; j < MAX_COUNTERS; j++) {
fd[i][j] = malloc(sizeof(int)*thread_num); fd[i][j] = malloc(sizeof(int)*thread_num);
mmap_array[i][j] = malloc( mmap_array[i][j] = zalloc(
sizeof(struct mmap_data)*thread_num); sizeof(struct mmap_data)*thread_num);
if (!fd[i][j] || !mmap_array[i][j]) if (!fd[i][j] || !mmap_array[i][j])
return -ENOMEM; return -ENOMEM;
......
...@@ -1371,7 +1371,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __used) ...@@ -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 (i = 0; i < MAX_NR_CPUS; i++) {
for (j = 0; j < MAX_COUNTERS; j++) { for (j = 0; j < MAX_COUNTERS; j++) {
fd[i][j] = malloc(sizeof(int)*thread_num); fd[i][j] = malloc(sizeof(int)*thread_num);
mmap_array[i][j] = malloc( mmap_array[i][j] = zalloc(
sizeof(struct mmap_data)*thread_num); sizeof(struct mmap_data)*thread_num);
if (!fd[i][j] || !mmap_array[i][j]) if (!fd[i][j] || !mmap_array[i][j])
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment