提交 47fbe53b 编写于 作者: D David Ahern 提交者: Arnaldo Carvalho de Melo

perf session: Fix crash with invalid CPU list

commit 5d67be97 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.comSigned-off-by: NDavid Ahern <dsahern@gmail.com>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 0e2a5f10
...@@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session, ...@@ -1333,6 +1333,10 @@ int perf_session__cpu_bitmap(struct perf_session *session,
} }
map = cpu_map__new(cpu_list); map = cpu_map__new(cpu_list);
if (map == NULL) {
pr_err("Invalid cpu_list\n");
return -1;
}
for (i = 0; i < map->nr; i++) { for (i = 0; i < map->nr; i++) {
int cpu = map->map[i]; int cpu = map->map[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册