diff options
author | David Ahern <dsahern@gmail.com> | 2011-11-13 12:45:27 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-11-16 07:02:26 -0500 |
commit | 47fbe53bef3b219a365ebf3eca949d6cd4c5291c (patch) | |
tree | d6403822660bed73283d781ca848fca2d6535ff6 /tools | |
parent | 0e2a5f10fb550835e199a3b56a80ed88232188e9 (diff) |
perf session: Fix crash with invalid CPU list
commit 5d67be9 added the option to specify a range of CPUs of interest,
but does not catch an invalid CPU list:
$ perf script -c foo
Segmentation fault (core dumped)
Cc: Anton Blanchard <anton@samba.org>
Link: http://lkml.kernel.org/r/1321206327-5881-1-git-send-email-dsahern@gmail.com
Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/session.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 85c1e6b76f0..0f4555ce906 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session, | |||
1333 | } | 1333 | } |
1334 | 1334 | ||
1335 | map = cpu_map__new(cpu_list); | 1335 | map = cpu_map__new(cpu_list); |
1336 | if (map == NULL) { | ||
1337 | pr_err("Invalid cpu_list\n"); | ||
1338 | return -1; | ||
1339 | } | ||
1336 | 1340 | ||
1337 | for (i = 0; i < map->nr; i++) { | 1341 | for (i = 0; i < map->nr; i++) { |
1338 | int cpu = map->map[i]; | 1342 | int cpu = map->map[i]; |