From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Wang Nan <wangnan0@huawei.com>,
Adrian Hunter <adrian.hunter@intel.com>,
Jiri Olsa <jolsa@redhat.com>, Zefan Li <lizefan@huawei.com>,
pi3orama@163.com, Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 18/19] perf report: Don't call map__kmap if map is NULL.
Date: Wed, 8 Apr 2015 11:23:38 -0300 [thread overview]
Message-ID: <1428503019-23820-19-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1428503019-23820-1-git-send-email-acme@kernel.org>
From: Wang Nan <wangnan0@huawei.com>
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>
---
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 b5b2ad4ca9c4..476cdf7afcca 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 &&
--
1.9.3
next prev parent reply other threads:[~2015-04-08 14:25 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 14:23 [GIT PULL 00/19] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 01/19] perf evlist: Fix inverted logic in perf_mmap__empty Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 02/19] perf kmaps: Check kmaps to make code more robust Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 03/19] tools lib traceevent: Honor operator priority Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 04/19] perf kmem: Respect -i option Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 05/19] perf sched replay: Use struct task_desc instead of struct task_task for correct meaning Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 06/19] perf sched replay: Increase the MAX_PID value to fix assertion failure problem Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 07/19] perf sched replay: Alloc the memory of pid_to_task dynamically to adapt to the unexpected change of pid_max Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 08/19] perf sched replay: Realloc the memory of pid_to_task stepwise to adapt to the different pid_max configurations Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 09/19] perf sched replay: Fix the segmentation fault problem caused by pr_err in threads Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 10/19] perf sched replay: Handle the dead halt of sem_wait when create_tasks() fails for any task Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 11/19] perf sched replay: Fix the EMFILE error caused by the limitation of the maximum open files Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 12/19] perf sched replay: Support using -f to override perf.data file ownership Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 13/19] perf sched replay: Use replay_repeat to calculate the runavg of cpu usage instead of the default value 10 Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 14/19] perf record: Add clockid parameter Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 15/19] perf tools: Merge all perf_event_attr print functions Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 16/19] perf probe: Fix ARM 32 building error Arnaldo Carvalho de Melo
2015-04-08 14:23 ` [PATCH 17/19] perf tests: Fix attr tests Arnaldo Carvalho de Melo
2015-04-08 14:23 ` Arnaldo Carvalho de Melo [this message]
2015-04-08 14:23 ` [PATCH 19/19] perf tools: Add 'I' event modifier for exclude_idle bit Arnaldo Carvalho de Melo
2015-04-08 15:05 ` [GIT PULL 00/19] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428503019-23820-19-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@kernel.org \
--cc=pi3orama@163.com \
--cc=wangnan0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).