summaryrefslogtreecommitdiff
path: root/tools/perf/util/map.h
diff options
context:
space:
mode:
authorWang Nan <wangnan0@huawei.com>2015-04-07 08:22:45 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-08 09:07:03 -0300
commitba92732e9808df679ddf75c5ea1c0caae6d7dce2 (patch)
treef00303efe3ed8cd3f2c5508d8af87db9b0137a82 /tools/perf/util/map.h
parent8ea92ceb748535799e3e9f35afb85bdc23bf6d7c (diff)
downloadlwn-ba92732e9808df679ddf75c5ea1c0caae6d7dce2.tar.gz
lwn-ba92732e9808df679ddf75c5ea1c0caae6d7dce2.zip
perf kmaps: Check kmaps to make code more robust
This patch add checks in places where map__kmap is used to get kmaps from struct kmap. Error messages are added at map__kmap to warn invalid accessing of kmap (for the case of !map->dso->kernel, kmap(map) does not exists at all). Also, introduces map__kmaps() to warn uninitialized kmaps. Reviewed-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Wang Nan <wangnan0@huawei.com> Cc: pi3orama@163.com Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Zefan Li <lizefan@huawei.com> Link: http://lkml.kernel.org/r/1428394966-131044-2-git-send-email-wangnan0@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.h')
-rw-r--r--tools/perf/util/map.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index 0e42438b1e59..ec19c59ca38e 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -76,10 +76,8 @@ static inline struct map_groups *map_groups__get(struct map_groups *mg)
void map_groups__put(struct map_groups *mg);
-static inline struct kmap *map__kmap(struct map *map)
-{
- return (struct kmap *)(map + 1);
-}
+struct kmap *map__kmap(struct map *map);
+struct map_groups *map__kmaps(struct map *map);
static inline u64 map__map_ip(struct map *map, u64 ip)
{