cpupower tools: Fix malloc of cpu_info structure
authorPalmer Cox <p@lmercox.com>
Tue, 27 Nov 2012 12:17:46 +0000 (13:17 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 27 Nov 2012 22:07:19 +0000 (23:07 +0100)
commit35a169737cdf9155e890d60eae2b8fffc16d16ba
treed119819f5ef7ae6af01cb7d931538b77b4c8bff4
parent53d2000ebe0618219f73ac866701533237180044
cpupower tools: Fix malloc of cpu_info structure

The cpu_info member of cpupower_topology was being declared as an unnamed
structure. This member was then being malloced using the size of the
parent cpupower_topology * the number of cpus. This works
because cpu_info is smaller than cpupower_topology. However, there is
no guarantee that will always be the case. Making cpu_info its own
top level structure (named cpuid_core_info) allows for mallocing the actual
size of this structure. This also lets us get rid of a redefinition of
the structure in topology.c with slightly different field names.

Signed-off-by: Palmer Cox <p@lmercox.com>
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
tools/power/cpupower/utils/helpers/helpers.h
tools/power/cpupower/utils/helpers/topology.c