From: "Jan Beulich" Subject: [PATCH] powernow: implement struct cpufreq_driver.verify Date: Fri, 05 Dec 2008 14:22:07 +0000 Message-ID: <4939471F.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline 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 Without this, under rare conditions hypervisor crashes are possible due to this method being called without checking against NULL. Signed-off-by: Jan Beulich Index: 2008-11-20/xen/arch/x86/acpi/cpufreq/powernow.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- 2008-11-20.orig/xen/arch/x86/acpi/cpufreq/powernow.c 2008-11-05 = 16:54:22.000000000 +0100 +++ 2008-11-20/xen/arch/x86/acpi/cpufreq/powernow.c 2008-12-03 = 11:56:27.000000000 +0100 @@ -129,6 +129,16 @@ static int powernow_cpufreq_target(struc return result; } =20 +static int powernow_cpufreq_verify(struct cpufreq_policy *policy) +{ + struct powernow_cpufreq_data *data; + + if (!policy || !(data =3D drv_data[policy->cpu])) + return -EINVAL; + + return cpufreq_frequency_table_verify(policy, data->freq_table); +} + static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy) { unsigned int i; @@ -243,6 +253,7 @@ static int powernow_cpufreq_cpu_exit(str } =20 static struct cpufreq_driver powernow_cpufreq_driver =3D { + .verify =3D powernow_cpufreq_verify, .target =3D powernow_cpufreq_target, .init =3D powernow_cpufreq_cpu_init, .exit =3D powernow_cpufreq_cpu_exit