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-unstable] x86/cpufreq: check array index before use

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86/cpufreq: check array index before use
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 08 Jul 2010 02:10:48 -0700
Delivery-date: Thu, 08 Jul 2010 02:15:31 -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 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

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