Message ID | 1437696348-2347-1-git-send-email-ricardo.neri-calderon@linux.intel.com |
---|---|
State | Accepted |
Headers | show |
On 07/24/2015 08:05 AM, 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@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) > Acked-by: Alex Hung <alex.hung@canonical.com>
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@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@canonical.com>
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)
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@linux.intel.com> --- src/cpu/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)