WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

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

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] x86/cpufreq: check array index before use
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 08 Jul 2010 02:11:17 -0700
Delivery-date: Thu, 08 Jul 2010 02:18:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] x86/cpufreq: check array index before use, Xen patchbot-4.0-testing <=