diff options
| author | Junhao He <[email protected]> | 2024-06-14 09:43:18 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2024-06-25 18:06:20 +0000 |
| commit | dd9a426eade634bf794c7e0f1b0c6659f556942f (patch) | |
| tree | 467c9f63097c76cac766996ae608eea2e2c6bbfa /tools/perf/scripts/python/syscall-counts.py | |
| parent | perf unwind-libunwind: Add malloc() failure handling (diff) | |
| download | kernel-dd9a426eade634bf794c7e0f1b0c6659f556942f.tar.gz kernel-dd9a426eade634bf794c7e0f1b0c6659f556942f.zip | |
perf pmus: Fixes always false when compare duplicates aliases
In the previous loop, all the members in the aliases[j-1] have been freed
and set to NULL. But in this loop, the function pmu_alias_is_duplicate()
compares the aliases[j] with the aliases[j-1] that has already been
disposed, so the function will always return false and duplicate aliases
will never be discarded.
If we find duplicate aliases, it skips the zfree aliases[j], which is
accompanied by a memory leak.
We can use the next aliases[j+1] to theck for duplicate aliases to
fixes the aliases NULL pointer dereference, then goto zfree code snippet
to release it.
After patch testing:
$ perf list --unit=hisi_sicl,cpa pmu
uncore cpa:
cpa_p0_rd_dat_32b
[Number of read ops transmitted by the P0 port which size is 32 bytes.
Unit: hisi_sicl,cpa]
cpa_p0_rd_dat_64b
[Number of read ops transmitted by the P0 port which size is 64 bytes.
Unit: hisi_sicl,cpa]
Fixes: c3245d2093c1 ("perf pmu: Abstract alias/event struct")
Signed-off-by: Junhao He <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Namhyung Kim <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts.py')
0 files changed, 0 insertions, 0 deletions
