* [PATCH] perf: report: don't call map__kmap if map is NULL.
@ 2015-04-08 10:59 Wang Nan
2015-04-08 12:56 ` Arnaldo Carvalho de Melo
2015-04-08 15:15 ` [tip:perf/core] perf report: Don't " tip-bot for Wang Nan
0 siblings, 2 replies; 3+ messages in thread
From: Wang Nan @ 2015-04-08 10:59 UTC (permalink / raw)
To: acme, jolsa, jolsa, adrian.hunter; +Cc: mingo, lizefan, linux-kernel, pi3orama
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 &&
--
1.8.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] perf: report: don't call map__kmap if map is NULL.
2015-04-08 10:59 [PATCH] perf: report: don't call map__kmap if map is NULL Wang Nan
@ 2015-04-08 12:56 ` Arnaldo Carvalho de Melo
2015-04-08 15:15 ` [tip:perf/core] perf report: Don't " tip-bot for Wang Nan
1 sibling, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-04-08 12:56 UTC (permalink / raw)
To: Wang Nan
Cc: jolsa, jolsa, adrian.hunter, mingo, lizefan, linux-kernel,
pi3orama
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.
^ permalink raw reply [flat|nested] 3+ messages in thread* [tip:perf/core] perf report: Don't call map__kmap if map is NULL.
2015-04-08 10:59 [PATCH] perf: report: don't call map__kmap if map is NULL Wang Nan
2015-04-08 12:56 ` Arnaldo Carvalho de Melo
@ 2015-04-08 15:15 ` tip-bot for Wang Nan
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Wang Nan @ 2015-04-08 15:15 UTC (permalink / raw)
To: linux-tip-commits
Cc: adrian.hunter, jolsa, mingo, acme, linux-kernel, tglx, lizefan,
hpa, wangnan0
Commit-ID: f6fcc1433a4a9057b2977313f31eadbc1c84268b
Gitweb: http://git.kernel.org/tip/f6fcc1433a4a9057b2977313f31eadbc1c84268b
Author: Wang Nan <wangnan0@huawei.com>
AuthorDate: Wed, 8 Apr 2015 10:59:32 +0000
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 8 Apr 2015 11:00:00 -0300
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>
---
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 &&
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-04-08 15:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-08 10:59 [PATCH] perf: report: don't call map__kmap if map is NULL Wang Nan
2015-04-08 12:56 ` Arnaldo Carvalho de Melo
2015-04-08 15:15 ` [tip:perf/core] perf report: Don't " tip-bot for Wang Nan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox