Jan Beulich
2010-Jul-06 15:51 UTC
[Xen-devel] [PATCH] x86/cpufreq: check array index before use
... rather than after. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- 2010-06-15.orig/xen/arch/x86/acpi/cpufreq/cpufreq.c 2010-07-06 16:08:59.000000000 +0200 +++ 2010-06-15/xen/arch/x86/acpi/cpufreq/cpufreq.c 2010-07-06 16:11:48.000000000 +0200 @@ -210,9 +210,11 @@ static u32 get_cur_val(cpumask_t mask) if (!cpu_isset(cpu, mask)) cpu = first_cpu(mask); - policy = cpufreq_cpu_policy[cpu]; + if (cpu >= NR_CPUS) + return 0; - if (cpu >= NR_CPUS || !policy || !drv_data[policy->cpu]) + policy = cpufreq_cpu_policy[cpu]; + if (!policy || !drv_data[policy->cpu]) return 0; switch (drv_data[policy->cpu]->cpu_feature) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Reasonably Related Threads
- [PATCH 07/12] cpufreq: allocate CPU masks dynamically
- [PATCH] cpufreq: error path fixes
- [PATCH V2 1/2] cpufreq, xenpm: fix cpufreq and xenpm mismatch
- [PATCH] xen: avoid crash enabling turbo mode
- [PATCH 1/2] cpufreq, powernow: enable/disable core performance boost for all cpus in policy