From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] x86/cpufreq: check array index before use Date: Tue, 06 Jul 2010 16:51:45 +0100 Message-ID: <4C336D310200007800009C9F@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part476A3501.0__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part476A3501.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... rather than after. Signed-off-by: Jan Beulich --- 2010-06-15.orig/xen/arch/x86/acpi/cpufreq/cpufreq.c 2010-07-06 = 16:08:59.000000000 +0200 +++ 2010-06-15/xen/arch/x86/acpi/cpufreq/cpufreq.c 2010-07-06 = 16:11:48.000000000 +0200 @@ -210,9 +210,11 @@ static u32 get_cur_val(cpumask_t mask) =20 if (!cpu_isset(cpu, mask)) cpu =3D first_cpu(mask); - policy =3D cpufreq_cpu_policy[cpu]; + if (cpu >=3D NR_CPUS) + return 0; =20 - if (cpu >=3D NR_CPUS || !policy || !drv_data[policy->cpu]) + policy =3D cpufreq_cpu_policy[cpu]; + if (!policy || !drv_data[policy->cpu]) return 0; =20 =20 switch (drv_data[policy->cpu]->cpu_feature) { --=__Part476A3501.0__= Content-Type: text/plain; name="x86-cpufreq-cpu-check.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-cpufreq-cpu-check.patch" ... rather than after.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- 2010-06-15.orig/xen/arch/x86/acpi/cpufreq/cpufreq.c 2010-07-06 = 16:08:59.000000000 +0200=0A+++ 2010-06-15/xen/arch/x86/acpi/cpufreq/cpufreq= .c 2010-07-06 16:11:48.000000000 +0200=0A@@ -210,9 +210,11 @@ static = u32 get_cur_val(cpumask_t mask)=0A =0A if (!cpu_isset(cpu, mask))=0A = cpu =3D first_cpu(mask);=0A- policy =3D cpufreq_cpu_policy[cpu];= =0A+ if (cpu >=3D NR_CPUS)=0A+ return 0;=0A =0A- if (cpu >=3D = NR_CPUS || !policy || !drv_data[policy->cpu])=0A+ policy =3D cpufreq_cpu= _policy[cpu];=0A+ if (!policy || !drv_data[policy->cpu])=0A = return 0; =0A =0A switch (drv_data[policy->cpu]->cpu_feature) {=0A --=__Part476A3501.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__Part476A3501.0__=--