[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] acpi: Make sure valid CPU is passed to do_pm_op()
# HG changeset patch # User Boris Ostrovsky <boris.ostrovsky@xxxxxxx> # Date 1348130629 -7200 # Node ID 474235d7c1dc44c018ec7538c8a9c8906512c55a # Parent c52e7afc96a91fca96364e5fda72626099161a54 acpi: Make sure valid CPU is passed to do_pm_op() Passing invalid CPU value to do_pm_op() will cause assertion in cpu_online(). Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxx> Such checks would, at a first glance, then also be missing at the top of various helper functions, but these check really were already redundant with the check in do_pm_op(). Remove the redundant checks for clarity and brevity. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> xen-unstable changeset: 25752:1df4fdbaade0 xen-unstable date: Wed Aug 15 07:43:25 UTC 2012 --- diff -r c52e7afc96a9 -r 474235d7c1dc xen/drivers/acpi/pmstat.c --- a/xen/drivers/acpi/pmstat.c Wed Sep 12 19:35:07 2012 +0100 +++ b/xen/drivers/acpi/pmstat.c Thu Sep 20 10:43:49 2012 +0200 @@ -203,8 +203,6 @@ static int get_cpufreq_para(struct xen_s struct list_head *pos; uint32_t cpu, i, j = 0; - if ( !op || !cpu_online(op->cpuid) ) - return -EINVAL; pmpt = processor_pminfo[op->cpuid]; policy = per_cpu(cpufreq_cpu_policy, op->cpuid); @@ -312,9 +310,6 @@ static int set_cpufreq_gov(struct xen_sy { struct cpufreq_policy new_policy, *old_policy; - if ( !op || !cpu_online(op->cpuid) ) - return -EINVAL; - old_policy = per_cpu(cpufreq_cpu_policy, op->cpuid); if ( !old_policy ) return -EINVAL; @@ -333,8 +328,6 @@ static int set_cpufreq_para(struct xen_s int ret = 0; struct cpufreq_policy *policy; - if ( !op || !cpu_online(op->cpuid) ) - return -EINVAL; policy = per_cpu(cpufreq_cpu_policy, op->cpuid); if ( !policy || !policy->governor ) @@ -411,22 +404,12 @@ static int set_cpufreq_para(struct xen_s return ret; } -static int get_cpufreq_avgfreq(struct xen_sysctl_pm_op *op) -{ - if ( !op || !cpu_online(op->cpuid) ) - return -EINVAL; - - op->u.get_avgfreq = cpufreq_driver_getavg(op->cpuid, USR_GETAVG); - - return 0; -} - int do_pm_op(struct xen_sysctl_pm_op *op) { int ret = 0; const struct processor_pminfo *pmpt; - if ( !op || !cpu_online(op->cpuid) ) + if ( !op || op->cpuid >= NR_CPUS || !cpu_online(op->cpuid) ) return -EINVAL; pmpt = processor_pminfo[op->cpuid]; @@ -462,7 +445,7 @@ int do_pm_op(struct xen_sysctl_pm_op *op case GET_CPUFREQ_AVGFREQ: { - ret = get_cpufreq_avgfreq(op); + op->u.get_avgfreq = cpufreq_driver_getavg(op->cpuid, USR_GETAVG); break; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |