summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/map.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-05-25 15:30:09 -0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-05-27 20:27:16 -0300
commitfacf3f0621b2e11957af1aae9085730ea78ccf85 (patch)
treed898cea7cc764ce699c7da383310ed9c28b0bf3b /tools/perf/util/map.c
parent6a2ffcddad22ead7ce75c5773e87895b91e7cca7 (diff)
downloadlinux-facf3f0621b2e11957af1aae9085730ea78ccf85.tar.gz
linux-facf3f0621b2e11957af1aae9085730ea78ccf85.tar.bz2
linux-facf3f0621b2e11957af1aae9085730ea78ccf85.zip
perf tools: Check if a map is still in use when deleting it
I.e. match RB_CLEAR_NODE() with RB_EMPTY_NODE(), to check that it isn't in a rb tree at the time of its deletion. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-vumvhird765id11zbx00d2r8@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.c')
-rw-r--r--tools/perf/util/map.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 0905b07072da..4d3a92d5dff3 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -225,6 +225,7 @@ struct map *map__new2(u64 start, struct dso *dso, enum map_type type)
void map__delete(struct map *map)
{
+ BUG_ON(!RB_EMPTY_NODE(&map->rb_node));
free(map);
}
@@ -446,7 +447,7 @@ static void __maps__purge(struct maps *maps)
struct map *pos = rb_entry(next, struct map, rb_node);
next = rb_next(&pos->rb_node);
- rb_erase(&pos->rb_node, root);
+ rb_erase_init(&pos->rb_node, root);
map__delete(pos);
}
}
@@ -456,7 +457,7 @@ static void __maps__purge_removed_maps(struct maps *maps)
struct map *pos, *n;
list_for_each_entry_safe(pos, n, &maps->removed_maps, node) {
- list_del(&pos->node);
+ list_del_init(&pos->node);
map__delete(pos);
}
}
@@ -671,7 +672,7 @@ static int maps__fixup_overlappings(struct maps *maps, struct map *map, FILE *fp
map__fprintf(pos, fp);
}
- rb_erase(&pos->rb_node, root);
+ rb_erase_init(&pos->rb_node, root);
/*
* Now check if we need to create new maps for areas not
* overlapped by the new map:
@@ -782,7 +783,7 @@ void maps__insert(struct maps *maps, struct map *map)
static void __maps__remove(struct maps *maps, struct map *map)
{
- rb_erase(&map->rb_node, &maps->entries);
+ rb_erase_init(&map->rb_node, &maps->entries);
}
void maps__remove(struct maps *maps, struct map *map)