ia64/xen-unstable

changeset 18672:27eec3c54d08

Add protection for xenpm access power management info

Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Oct 21 09:48:08 2008 +0100 (2008-10-21)
parents a9f299b11b7f
children 687601e21055
files xen/drivers/acpi/pmstat.c xen/drivers/cpufreq/utility.c
line diff
     1.1 --- a/xen/drivers/acpi/pmstat.c	Tue Oct 21 09:47:33 2008 +0100
     1.2 +++ b/xen/drivers/acpi/pmstat.c	Tue Oct 21 09:48:08 2008 +0100
     1.3 @@ -52,7 +52,7 @@ int do_get_pm_info(struct xen_sysctl_get
     1.4      int ret = 0;
     1.5      const struct processor_pminfo *pmpt;
     1.6  
     1.7 -    if ( (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
     1.8 +    if ( !op || (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
     1.9          return -EINVAL;
    1.10      pmpt = processor_pminfo[op->cpuid];
    1.11  
    1.12 @@ -87,7 +87,7 @@ int do_get_pm_info(struct xen_sysctl_get
    1.13          uint64_t tmp_idle_ns;
    1.14          struct pm_px *pxpt = cpufreq_statistic_data[op->cpuid];
    1.15  
    1.16 -        if ( !pxpt )
    1.17 +        if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
    1.18              return -ENODATA;
    1.19  
    1.20          total_idle_ns = get_cpu_idle_time(op->cpuid);
     2.1 --- a/xen/drivers/cpufreq/utility.c	Tue Oct 21 09:47:33 2008 +0100
     2.2 +++ b/xen/drivers/cpufreq/utility.c	Tue Oct 21 09:48:08 2008 +0100
     2.3 @@ -129,7 +129,7 @@ void cpufreq_statistic_reset(unsigned in
     2.4      struct pm_px *pxpt = cpufreq_statistic_data[cpuid];
     2.5      const struct processor_pminfo *pmpt = processor_pminfo[cpuid];
     2.6  
     2.7 -    if ( !pxpt || !pmpt )
     2.8 +    if ( !pmpt || !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
     2.9          return;
    2.10  
    2.11      count = pmpt->perf.state_count;