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

cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier

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 <srikar@linux.vnet.ibm.com>
Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200922080254.41497-1-srikar@linux.vnet.ibm.com

authored by

Srikar Dronamraju and committed by
Michael Ellerman
a2d0230b 9686e431

+6 -3
+6 -3
drivers/cpufreq/powernv-cpufreq.c
··· 885 885 unsigned long action, void *unused) 886 886 { 887 887 int cpu; 888 - struct cpufreq_policy cpu_policy; 888 + struct cpufreq_policy *cpu_policy; 889 889 890 890 rebooting = true; 891 891 for_each_online_cpu(cpu) { 892 - cpufreq_get_policy(&cpu_policy, cpu); 893 - powernv_cpufreq_target_index(&cpu_policy, get_nominal_index()); 892 + cpu_policy = cpufreq_cpu_get(cpu); 893 + if (!cpu_policy) 894 + continue; 895 + powernv_cpufreq_target_index(cpu_policy, get_nominal_index()); 896 + cpufreq_cpu_put(cpu_policy); 894 897 } 895 898 896 899 return NOTIFY_DONE;