[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86/cpufreq: check array index before use



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1278578686 -3600
# Node ID df63728e1680ce7827bd58f6bda453f70ed41ad9
# Parent  a0f0ae5be814f19590d5a59d91ab7183cd1a325f
x86/cpufreq: check array index before use

... rather than after.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -r a0f0ae5be814 -r df63728e1680 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c       Tue Jul 06 17:58:37 2010 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c       Thu Jul 08 09:44:46 2010 +0100
@@ -210,9 +210,11 @@ static u32 get_cur_val(cpumask_t mask)
 
     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) {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.