28 lines
748 B
Diff
28 lines
748 B
Diff
|
# HG changeset patch
|
||
|
# User Keir Fraser <keir.fraser@citrix.com>
|
||
|
# Date 1278578686 -3600
|
||
|
# Node ID df63728e1680ce7827bd58f6bda453f70ed41ad9
|
||
|
# Parent a0f0ae5be814f19590d5a59d91ab7183cd1a325f
|
||
|
x86/cpufreq: check array index before use
|
||
|
|
||
|
... rather than after.
|
||
|
|
||
|
Signed-off-by: Jan Beulich <jbeulich@novell.com>
|
||
|
|
||
|
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
|
||
|
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
|
||
|
@@ -210,9 +210,11 @@
|
||
|
|
||
|
if (!cpu_isset(cpu, mask))
|
||
|
cpu = first_cpu(mask);
|
||
|
+ if (cpu >= NR_CPUS)
|
||
|
+ return 0;
|
||
|
+
|
||
|
policy = cpufreq_cpu_policy[cpu];
|
||
|
-
|
||
|
- if (cpu >= NR_CPUS || !policy || !drv_data[policy->cpu])
|
||
|
+ if (!policy || !drv_data[policy->cpu])
|
||
|
return 0;
|
||
|
|
||
|
switch (drv_data[policy->cpu]->cpu_feature) {
|