ia64/xen-unstable

changeset 18887:3db54d2aa8bd

powernow: implement struct cpufreq_driver.verify

Without this, under rare conditions hypervisor crashes are possible
due to this method being called without checking against NULL.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Dec 05 15:22:21 2008 +0000 (2008-12-05)
parents e34f3e314ecf
children 3905cbf523b2
files xen/arch/x86/acpi/cpufreq/powernow.c
line diff
     1.1 --- a/xen/arch/x86/acpi/cpufreq/powernow.c	Fri Dec 05 15:21:59 2008 +0000
     1.2 +++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Fri Dec 05 15:22:21 2008 +0000
     1.3 @@ -129,6 +129,16 @@ static int powernow_cpufreq_target(struc
     1.4      return result;
     1.5  }
     1.6  
     1.7 +static int powernow_cpufreq_verify(struct cpufreq_policy *policy)
     1.8 +{
     1.9 +    struct powernow_cpufreq_data *data;
    1.10 +
    1.11 +    if (!policy || !(data = drv_data[policy->cpu]))
    1.12 +        return -EINVAL;
    1.13 +
    1.14 +    return cpufreq_frequency_table_verify(policy, data->freq_table);
    1.15 +}
    1.16 +
    1.17  static int powernow_cpufreq_cpu_init(struct cpufreq_policy *policy)
    1.18  {
    1.19      unsigned int i;
    1.20 @@ -243,6 +253,7 @@ static int powernow_cpufreq_cpu_exit(str
    1.21  }
    1.22  
    1.23  static struct cpufreq_driver powernow_cpufreq_driver = {
    1.24 +    .verify = powernow_cpufreq_verify,
    1.25      .target = powernow_cpufreq_target,
    1.26      .init   = powernow_cpufreq_cpu_init,
    1.27      .exit   = powernow_cpufreq_cpu_exit