|
|
|
|
|
|
|
|
|
|
xen-devel
[Xen-devel] [PATCH]Make sure processor_pminfo initialized before use it
Make sure processor_pminfo not null before use it
If processor_pminfo not initialized, it will cause xen panic.
Signed-off-by: Yang Zhang <yang.z.zhang@xxxxxxxxx>
diff -r bdd19847ae63 xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c Wed Sep 07 10:37:48 2011 +0100
+++ b/xen/drivers/cpufreq/cpufreq.c Thu Sep 08 13:40:23 2011 +0800
@@ -91,7 +91,7 @@ int __init cpufreq_register_governor(str
int cpufreq_limit_change(unsigned int cpu)
{
- struct processor_performance *perf = &processor_pminfo[cpu]->perf;
+ struct processor_performance *perf;
struct cpufreq_policy *data;
struct cpufreq_policy policy;
@@ -99,6 +99,7 @@ int cpufreq_limit_change(unsigned int cp
!processor_pminfo[cpu])
return -ENODEV;
+ perf = &processor_pminfo[cpu]->perf;
if (perf->platform_limit >= perf->state_count)
return -EINVAL;
@@ -120,12 +121,14 @@ int cpufreq_add_cpu(unsigned int cpu)
struct cpufreq_dom *cpufreq_dom = NULL;
struct cpufreq_policy new_policy;
struct cpufreq_policy *policy;
- struct processor_performance *perf = &processor_pminfo[cpu]->perf;
+ struct processor_performance *perf;
/* to protect the case when Px was not controlled by xen */
- if (!processor_pminfo[cpu] ||
- !(perf->init & XEN_PX_INIT) ||
- !cpu_online(cpu))
+ if (!processor_pminfo[cpu] || !cpu_online(cpu))
+ return -EINVAL;
+
+ perf = &processor_pminfo[cpu]->perf;
+ if (!(perf->init & XEN_PX_INIT))
return -EINVAL;
if (!cpufreq_driver)
@@ -261,12 +264,14 @@ int cpufreq_del_cpu(unsigned int cpu)
struct list_head *pos;
struct cpufreq_dom *cpufreq_dom = NULL;
struct cpufreq_policy *policy;
- struct processor_performance *perf = &processor_pminfo[cpu]->perf;
+ struct processor_performance *perf;
/* to protect the case when Px was not controlled by xen */
- if (!processor_pminfo[cpu] ||
- !(perf->init & XEN_PX_INIT) ||
- !cpu_online(cpu))
+ if (!processor_pminfo[cpu] || !cpu_online(cpu))
+ return -EINVAL;
+
+ perf = &processor_pminfo[cpu]->perf;
+ if (!(perf->init & XEN_PX_INIT))
return -EINVAL;
if (!per_cpu(cpufreq_cpu_policy, cpu))
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH]Make sure processor_pminfo initialized before use it,
Zhang, Yang Z <=
|
|
|
|
|