ACK: [PATCH] cpu/cpufreq: Iterate over the correct number of CPUs in _test_sw_any
Colin Ian King
colin.king at canonical.com
Fri Jul 24 08:22:52 UTC 2015
On 24/07/15 01:05, Ricardo Neri wrote:
> cpu_test_sw_any goes into a loop to set the frequency of all the
> available CPUs. However, the loop iterates beyond the limits of the
> CPUs array. Given that functions such as cpu_set_lowest_frequency
> derreference members of struct cpu, iterating beyond the limits of the
> array might cause segmentation faults.
>
> Signed-off-by: Ricardo Neri <ricardo.neri-calderon at linux.intel.com>
> ---
> src/cpu/cpufreq/cpufreq.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/cpu/cpufreq/cpufreq.c b/src/cpu/cpufreq/cpufreq.c
> index 40f6a30..35812f4 100644
> --- a/src/cpu/cpufreq/cpufreq.c
> +++ b/src/cpu/cpufreq/cpufreq.c
> @@ -507,7 +507,7 @@ static int cpufreq_test_sw_any(fwts_framework *fw)
>
> ok = true;
>
> - for (i = 0; i <= num_cpus; i++) {
> + for (i = 0; i < num_cpus; i++) {
> struct cpu *cpu = &cpus[i];
>
> if (!cpu->online)
>
Thanks Ricardo
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list