mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
perf report: Don't call map__kmap if map is NULL.
report__warn_kptr_restrict() calls map__kmap(kernel_map) before checking kernel_map againest NULL. Which is dangerous, since map__kmap() will return a invalid and not NULL address. It will trigger a warning message in map__kmap() after the patch "perf: kmaps: enforce usage of kmaps to protect futher bugs." was applied. This patch fixes it by adding the missing checking. Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Zefan Li <lizefan@huawei.com> Cc: pi3orama@163.com Link: http://lkml.kernel.org/r/1428490772-135393-1-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
54a50f93eb
commit
f6fcc1433a
1 changed files with 1 additions and 1 deletions
|
@ -347,7 +347,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
|
|||
static void report__warn_kptr_restrict(const struct report *rep)
|
||||
{
|
||||
struct map *kernel_map = rep->session->machines.host.vmlinux_maps[MAP__FUNCTION];
|
||||
struct kmap *kernel_kmap = map__kmap(kernel_map);
|
||||
struct kmap *kernel_kmap = kernel_map ? map__kmap(kernel_map) : NULL;
|
||||
|
||||
if (kernel_map == NULL ||
|
||||
(kernel_map->dso->hit &&
|
||||
|
|
Loading…
Reference in a new issue