summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorlonglong yan <yanlonglong@kylinos.cn>2026-09-02 14:59:22 +0800
committerLen Brown <len.brown@intel.com>2026-10-03 13:00:54 -0400
commit148aefa949b1da358c0ebd89e61b3efd48782b82 (patch)
tree9a1382e73700db4adac1bb84245291f97cebf170 /tools/perf/scripts/python
parent1de8307e861759386057f8683bdf0594b2c803f0 (diff)
downloadlinux-next-148aefa949b1da358c0ebd89e61b3efd48782b82.tar.gz
linux-next-148aefa949b1da358c0ebd89e61b3efd48782b82.zip
tools/power turbostat: add NULL check after calloc()
Three calloc() calls in turbostat lack NULL return checks, leading to potential NULL pointer dereferences on allocation failure: 1. rapl_perf_init(): the allocated `domain_visited` is used later via memset(domain_visited, 0, ...) without checking for NULL. 2. added_perf_counters_init_(): the allocated `domain_visited` is used later via memset() and domain_visited[next_domain] without checking for NULL. 3. pmt_add_counter(): the allocated `pcounter` is dereferenced immediately via strncpy(pcounter->name, ...) without checking for NULL. Add NULL checks after each calloc(), using the same error handling style already present in each function: err(-1, ...) for rapl_perf_init(), errx(1, ...) for added_perf_counters_init_(), and return 1 for pmt_add_counter(). Signed-off-by: longlong yan <yanlonglong@kylinos.cn> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions