Skip to content

Commit def6cd4

Browse files
captain5050gregkh
authored andcommitted
perf maps: Fix fixup_overlap_and_insert that can break sorted by name order
[ Upstream commit c4f3ff3 ] When an entry in the address array is replaced, the corresponding name entry is replaced. The entries names may sort differently and so it is important that the sorted by name property be cleared on the maps. Fixes: 0d11fab ("perf maps: Fixup maps_by_name when modifying maps_by_address") Signed-off-by: Ian Rogers <irogers@google.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 59a58ad commit def6cd4

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

tools/perf/util/maps.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)
924924
if (maps_by_name) {
925925
map__put(maps_by_name[ni]);
926926
maps_by_name[ni] = map__get(new);
927+
maps__set_maps_by_name_sorted(maps, false);
927928
}
928929

929930
err = __maps__insert_sorted(maps, i + 1, after, NULL);
@@ -949,6 +950,7 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)
949950
if (maps_by_name) {
950951
map__put(maps_by_name[ni]);
951952
maps_by_name[ni] = map__get(new);
953+
maps__set_maps_by_name_sorted(maps, false);
952954
}
953955

954956
check_invariants(maps);

0 commit comments

Comments
 (0)