]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
cpufreq: armada-8k: Fix off by one in armada_8k_cpufreq_free_table()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 1 Jul 2025 22:30:01 +0000 (17:30 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:21:30 +0000 (16:21 +0200)
commit 4a26df233266a628157d7f0285451d8655defdfc upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/cpufreq/armada-8k-cpufreq.c

index b0fc5e84f8570f39e54b9be5137753ac02f8acab..cab86a9be6bd3350f038a1f1da68bbffd587dad4 100644 (file)
@@ -96,7 +96,7 @@ static void armada_8k_cpufreq_free_table(struct freq_table *freq_tables)
 {
        int opps_index, nb_cpus = num_possible_cpus();
 
-       for (opps_index = 0 ; opps_index <= nb_cpus; opps_index++) {
+       for (opps_index = 0 ; opps_index < nb_cpus; opps_index++) {
                int i;
 
                /* If cpu_dev is NULL then we reached the end of the array */