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

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



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1278579725 -3600
# Node ID 96d72369813fa3373bedcd1ed989c3721ba8e8f5
# Parent  76fa9ab64a986a4665a278b9b01c27d427dea683
x86/cpufreq: check array index before use

... rather than after.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
xen-unstable changeset:   21744:df63728e1680
xen-unstable date:        Thu Jul 08 09:44:46 2010 +0100
---
 xen/arch/x86/acpi/cpufreq/cpufreq.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff -r 76fa9ab64a98 -r 96d72369813f xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c       Thu Jul 08 09:59:16 2010 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c       Thu Jul 08 10:02:05 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®.