Skip to content

Commit 4a26df2

Browse files
Dan Carpentervireshk
authored andcommitted
cpufreq: armada-8k: Fix off by one in armada_8k_cpufreq_free_table()
The freq_tables[] array has num_possible_cpus() elements so, to avoid an out of bounds access, this loop should be capped at "< nb_cpus" instead of "<= nb_cpus". The freq_tables[] array is allocated in armada_8k_cpufreq_init(). Cc: stable@vger.kernel.org Fixes: f525a67 ("cpufreq: ap806: add cpufreq driver for Armada 8K") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
1 parent b1b41bc commit 4a26df2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/cpufreq/armada-8k-cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static void armada_8k_cpufreq_free_table(struct freq_table *freq_tables)
103103
{
104104
int opps_index, nb_cpus = num_possible_cpus();
105105

106-
for (opps_index = 0 ; opps_index <= nb_cpus; opps_index++) {
106+
for (opps_index = 0 ; opps_index < nb_cpus; opps_index++) {
107107
int i;
108108

109109
/* If cpu_dev is NULL then we reached the end of the array */

0 commit comments

Comments
 (0)