]> Git Repo - linux.git/commitdiff
cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier
authorSrikar Dronamraju <[email protected]>
Tue, 22 Sep 2020 08:02:54 +0000 (13:32 +0530)
committerMichael Ellerman <[email protected]>
Thu, 8 Oct 2020 10:17:16 +0000 (21:17 +1100)
The patch avoids allocating cpufreq_policy on stack hence fixing frame
size overflow in 'powernv_cpufreq_reboot_notifier':

  drivers/cpufreq/powernv-cpufreq.c: In function powernv_cpufreq_reboot_notifier:
  drivers/cpufreq/powernv-cpufreq.c:906:1: error: the frame size of 2064 bytes is larger than 2048 bytes

Fixes: cf30af76 ("cpufreq: powernv: Set the cpus to nominal frequency during reboot/kexec")
Signed-off-by: Srikar Dronamraju <[email protected]>
Reviewed-by: Daniel Axtens <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
drivers/cpufreq/powernv-cpufreq.c

index a9af15e994ccf057074f984efd8b333258db73bf..e439b43c19ebecbc35fe288c7595d753187f33f5 100644 (file)
@@ -885,12 +885,15 @@ static int powernv_cpufreq_reboot_notifier(struct notifier_block *nb,
                                unsigned long action, void *unused)
 {
        int cpu;
-       struct cpufreq_policy cpu_policy;
+       struct cpufreq_policy *cpu_policy;
 
        rebooting = true;
        for_each_online_cpu(cpu) {
-               cpufreq_get_policy(&cpu_policy, cpu);
-               powernv_cpufreq_target_index(&cpu_policy, get_nominal_index());
+               cpu_policy = cpufreq_cpu_get(cpu);
+               if (!cpu_policy)
+                       continue;
+               powernv_cpufreq_target_index(cpu_policy, get_nominal_index());
+               cpufreq_cpu_put(cpu_policy);
        }
 
        return NOTIFY_DONE;
This page took 0.054685 seconds and 4 git commands to generate.