perf test: Fix a leaked map reference in the arch dwarf unwind tests
Subsystems (2)
PATCH 1/1 perf test: Fix a leaked map reference in the arch dwarf unwind tests
maps__find() has returned a reference to the map it finds since commit 42fd623b58db ("perf maps: Get map before returning in maps__find"), which updated arch/x86/tests/dwarf-unwind.c but missed the arm, arm64 and powerpc copies. Release the map after reading its end, as x86 does. All other callers of maps__find() already release what they get.
--- tools/perf/arch/arm/tests/dwarf-unwind.c | 1 + tools/perf/arch/arm64/tests/dwarf-unwind.c | 1 + tools/perf/arch/powerpc/tests/dwarf-unwind.c | 1 + 3 files changed, 3 insertions(+)
tools/perf/arch/arm/tests/dwarf-unwind.c +1 -0
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);
tools/perf/arch/arm64/tests/dwarf-unwind.c +1 -0
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);
tools/perf/arch/powerpc/tests/dwarf-unwind.c +1 -0
@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);
Signature · 1 line
2.50.1
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines
maps__find()has returned a reference to the map it finds since commit42fd623b58db("perf maps: Get map before returning inmaps__find"), which updatedarch/x86/tests/dwarf-unwind.cbut missed the arm, arm64 and powerpc copies. Release the map after reading its end, as x86 does. All other callers ofmaps__find()already release what they get.Fixes 42fd623b58db ("perf maps: Get map before returning in maps__find")Signed-off-by Chen Pei <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 10 lines · Chen Pei
maps__find()has returned a reference to the map it finds since commit42fd623b58db("perf maps: Get map before returning inmaps__find"), which updatedarch/x86/tests/dwarf-unwind.cbut missed the arm, arm64 and powerpc copies. Release the map after reading its end, as x86 does. All other callers ofmaps__find()already release what they get.Fixes 42fd623b58db ("perf maps: Get map before returning in maps__find")Signed-off-by Chen Pei <[email protected]>
Thanks,
Ian
Quoted 45 lines
--- tools/perf/arch/arm/tests/dwarf-unwind.c | 1 + tools/perf/arch/arm64/tests/dwarf-unwind.c | 1 + tools/perf/arch/powerpc/tests/dwarf-unwind.c | 1 + 3 files changed, 3 insertions(+)tools/perf/arch/arm/tests/dwarf-unwind.c +1
-0@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);tools/perf/arch/arm64/tests/dwarf-unwind.c +1
-0@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size);tools/perf/arch/powerpc/tests/dwarf-unwind.c +1
-1@@ -34,6 +34,7 @@ static int sample_ustack(struct perf_sample *sample, } stack_size =map__end (map) - sp; +map__put (map); stack_size = stack_size >STACK_SIZE ?STACK_SIZE : stack_size;memcpy (buf, (void *) sp, stack_size); --2.50.1
Quoted 9 lines · Ian Rogers
Quoted 8 lines · Chen Pei
maps__find()has returned a reference to the map it finds since commit42fd623b58db("perf maps: Get map before returning inmaps__find"), which updatedarch/x86/tests/dwarf-unwind.cbut missed the arm, arm64 and powerpc copies. Release the map after reading its end, as x86 does. All other callers ofmaps__find()already release what they get.
Quoted 4 lines
Quoted 2 lines
Fixes 42fd623b58db ("perf maps: Get map before returning in maps__find")Signed-off-by Chen Pei <[email protected]>Reviewed-by Ian Rogers <[email protected]>
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo
Quoted 9 lines · Ian Rogers
Quoted 8 lines · Chen Pei
maps__find()has returned a reference to the map it finds since commit42fd623b58db("perf maps: Get map before returning inmaps__find"), which updatedarch/x86/tests/dwarf-unwind.cbut missed the arm, arm64 and powerpc copies. Release the map after reading its end, as x86 does. All other callers ofmaps__find()already release what they get.
Quoted 4 lines
Quoted 2 lines
Fixes 42fd623b58db ("perf maps: Get map before returning in maps__find")Signed-off-by Chen Pei <[email protected]>Reviewed-by Ian Rogers <[email protected]>
Thanks, applied to perf-tools-next, for v7.4.
- Arnaldo