[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Add protection for xenpm access power management info



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1224578888 -3600
# Node ID 27eec3c54d08b8941eb06c1fae6fea5f98013e43
# Parent  a9f299b11b7fd381cc2391687a8367d74eea5bd0
Add protection for xenpm access power management info

Signed-off-by: Liu Jinsong <jinsong.liu@xxxxxxxxx>
---
 xen/drivers/acpi/pmstat.c     |    4 ++--
 xen/drivers/cpufreq/utility.c |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff -r a9f299b11b7f -r 27eec3c54d08 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c Tue Oct 21 09:47:33 2008 +0100
+++ b/xen/drivers/acpi/pmstat.c Tue Oct 21 09:48:08 2008 +0100
@@ -52,7 +52,7 @@ int do_get_pm_info(struct xen_sysctl_get
     int ret = 0;
     const struct processor_pminfo *pmpt;
 
-    if ( (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
+    if ( !op || (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
         return -EINVAL;
     pmpt = processor_pminfo[op->cpuid];
 
@@ -87,7 +87,7 @@ int do_get_pm_info(struct xen_sysctl_get
         uint64_t tmp_idle_ns;
         struct pm_px *pxpt = cpufreq_statistic_data[op->cpuid];
 
-        if ( !pxpt )
+        if ( !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
             return -ENODATA;
 
         total_idle_ns = get_cpu_idle_time(op->cpuid);
diff -r a9f299b11b7f -r 27eec3c54d08 xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c     Tue Oct 21 09:47:33 2008 +0100
+++ b/xen/drivers/cpufreq/utility.c     Tue Oct 21 09:48:08 2008 +0100
@@ -129,7 +129,7 @@ void cpufreq_statistic_reset(unsigned in
     struct pm_px *pxpt = cpufreq_statistic_data[cpuid];
     const struct processor_pminfo *pmpt = processor_pminfo[cpuid];
 
-    if ( !pxpt || !pmpt )
+    if ( !pmpt || !pxpt || !pxpt->u.pt || !pxpt->u.trans_pt )
         return;
 
     count = pmpt->perf.state_count;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.