lkml.org 
[lkml]   [2015]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] perf: report: don't call map__kmap if map is NULL.
Em Wed, Apr 08, 2015 at 10:59:32AM +0000, Wang Nan escreveu:
> 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 patch "perf: kmaps: enforce
> usage of kmaps to protect futher bugs."
>
> This patch fixes it by adding the missing checking.
>
> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> ---
> tools/perf/builtin-report.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index b5b2ad4..476cdf7 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -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 &&

Thanks, applied.


\
 
 \ /
  Last update: 2015-04-08 15:41    [W:0.034 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site