]> www.infradead.org Git - users/jedix/linux-maple.git/commit
perf pmu: Handle memory failure in tool_pmu__new()
authorThomas Richter <tmricht@linux.ibm.com>
Wed, 19 Mar 2025 12:28:20 +0000 (13:28 +0100)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 20 Mar 2025 00:00:16 +0000 (17:00 -0700)
commit431db90a7303cb394c5a881b4479946f64052727
tree91787d85ccc84bcd2b313796261a5b462db5d176
parent6d2dcd635204c023eb5328ad7d38b198a5558c9b
perf pmu: Handle memory failure in tool_pmu__new()

On linux-next
commit 72c6f57a4193 ("perf pmu: Dynamically allocate tool PMU")
allocated PMU named "tool" dynamicly. However that allocation
can fail and a NULL pointer is returned. That case is currently
not handled and would result in an invalid address reference.
Add a check for NULL pointer.

Fixes: 72c6f57a4193 ("perf pmu: Dynamically allocate tool PMU")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Link: https://lore.kernel.org/r/20250319122820.2898333-1-tmricht@linux.ibm.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/pmus.c
tools/perf/util/tool_pmu.c