Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: f525a670533d ("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>

authored by

Dan Carpenter and committed by
Viresh Kumar
4a26df23 b1b41bc0

+1 -1
+1 -1
drivers/cpufreq/armada-8k-cpufreq.c
··· 103 103 { 104 104 int opps_index, nb_cpus = num_possible_cpus(); 105 105 106 - for (opps_index = 0 ; opps_index <= nb_cpus; opps_index++) { 106 + for (opps_index = 0 ; opps_index < nb_cpus; opps_index++) { 107 107 int i; 108 108 109 109 /* If cpu_dev is NULL then we reached the end of the array */