Skip to content

Commit 47fbe53

Browse files
dsahernacmel
authored andcommitted
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>
1 parent 0e2a5f1 commit 47fbe53

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎tools/perf/util/session.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session,
13331333
}
13341334

13351335
map = cpu_map__new(cpu_list);
1336+
if (map == NULL) {
1337+
pr_err("Invalid cpu_list\n");
1338+
return -1;
1339+
}
13361340

13371341
for (i = 0; i < map->nr; i++) {
13381342
int cpu = map->map[i];

0 commit comments

Comments
 (0)