diff options
| author | Ian Rogers <irogers@google.com> | 2026-04-07 19:08:38 -0700 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2026-04-08 10:28:49 -0700 |
| commit | f552b132e4d5248715828e7e5c2bf7889bf05b2e (patch) | |
| tree | 822bc82b006eec52f91755701198eb99e53d7562 /tools/perf | |
| parent | c4f3ff3289380437d26177e8f2fe4b7507816ee3 (diff) | |
perf maps: Fix copy_from that can break sorted by name order
When an parent is copied into a child the name array is populated in
address not name order. Make sure the name array isn't flagged as sorted.
Fixes: 659ad3492b91 ("perf maps: Switch from rbtree to lazily sorted array for addresses")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/util/maps.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index b44bc41f51f3..81a97ac34077 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -1081,16 +1081,9 @@ int maps__copy_from(struct maps *dest, struct maps *parent) map__put(new); } maps__set_maps_by_address_sorted(dest, maps__maps_by_address_sorted(parent)); - if (!err) { - RC_CHK_ACCESS(dest)->last_search_by_name_idx = - RC_CHK_ACCESS(parent)->last_search_by_name_idx; - maps__set_maps_by_name_sorted(dest, - dest_maps_by_name && - maps__maps_by_name_sorted(parent)); - } else { - RC_CHK_ACCESS(dest)->last_search_by_name_idx = 0; - maps__set_maps_by_name_sorted(dest, false); - } + RC_CHK_ACCESS(dest)->last_search_by_name_idx = 0; + /* Values were copied into the name array in address order. */ + maps__set_maps_by_name_sorted(dest, false); } else { /* Unexpected copying to a maps containing entries. */ for (unsigned int i = 0; !err && i < n; i++) { |
