[PATCH 5/6] perf maps: Add missing map__set_kmap_maps() when replacing a kernel map

Arnaldo Carvalho de Melo
2025-02-28T21:18:01Z

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Since in this case __maps__insert_sorted() is not called and thus
doesn't have the opportunity to do the needed map__set_kmap_maps() calls on
the new map.

Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https://lore.kernel.org/lkml/Z7-May5w9VQd5QD0@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/maps.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c
index 77df9701d5ad7de3..0b40d901675ed57e 100644
--- a/tools/perf/util/maps.c
+++ b/tools/perf/util/maps.c
@@ -948,6 +948,8 @@ static int __maps__fixup_overlap_and_insert(struct maps *maps, struct map *new)
maps_by_name[ni] = map__get(new);
}

+ map__set_kmap_maps(new, maps);
+
check_invariants(maps);
return err;
}
--
2.48.1