linux-yocto/tools/power/cpupower
Zhongqiu Han 942a4b97fc pm: cpupower: bench: Prevent NULL dereference on malloc failure
[ Upstream commit 208baa3ec9 ]

If malloc returns NULL due to low memory, 'config' pointer can be NULL.
Add a check to prevent NULL dereference.

Link: https://lore.kernel.org/r/20250219122715.3892223-1-quic_zhonhan@quicinc.com
Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-04-25 10:45:10 +02:00
..
bench pm: cpupower: bench: Prevent NULL dereference on malloc failure 2025-04-25 10:45:10 +02:00
debug
lib pm:cpupower: Add missing powercap_set_enabled() stub function 2024-10-04 16:28:55 +02:00
man cpupower: fix reference to nonexistent document 2023-11-20 11:59:33 +01:00
po
utils cpupower: fix TSC MHz calculation 2025-02-08 09:51:52 +01:00
.gitignore
cpupower-completion.sh
Makefile cpupower: Add Georgian translation to Makefile LANGUAGES 2023-08-17 14:28:16 -06:00
README
TODO

The cpupower package consists of the following elements:

requirements

On x86 pciutils is needed at runtime (-lpci). For compilation pciutils-devel (pci/pci.h) and a gcc version providing cpuid.h is needed. For both it's not explicitly checked for (yet).

libcpupower

"libcpupower" is a library which offers a unified access method for userspace tools and programs to the cpufreq core and drivers in the Linux kernel. This allows for code reduction in userspace tools, a clean implementation of the interaction to the cpufreq core, and support for both the sysfs and proc interfaces [depending on configuration, see below].

compilation and installation

make su make install

should suffice on most systems. It builds libcpupower to put in /usr/lib; cpupower, cpufreq-bench_plot.sh to put in /usr/bin; and cpufreq-bench to put in /usr/sbin. If you want to set up the paths differently and/or want to configure the package to your specific needs, you need to open "Makefile" with an editor of your choice and edit the block marked CONFIGURATION.

THANKS

Many thanks to Mattia Dongili who wrote the autotoolization and libtoolization, the manpages and the italian language file for cpupower; to Dave Jones for his feedback and his dump_psb tool; to Bruno Ducrot for his powernow-k8-decode and intel_gsic tools as well as the french language file; and to various others commenting on the previous (pre-)releases of cpupower.

    Dominik Brodowski