From: "Jan Beulich" Subject: [PATCH v2] powernow: don't read never initialoized structure member Date: Thu, 03 Nov 2011 15:49:15 +0000 Message-ID: <4EB2C60B020000780005ECCF@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartC8E739EB.1__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "xen-devel@lists.xensource.com" Cc: mark.langsdorf@amd.com List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartC8E739EB.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline c/s 20361:51b031b0737e removed the writing of struct processor_performance's shared_cpu_map member, but the powernow driver still has code to read it (though presumably that code path can't be taken on actual hardware supported by the powernow driver except when the number of CPUs to be coordinated is one). Remove the use of the field along with the field itself. Signed-off-by: Jan Beulich --- a/xen/arch/x86/acpi/cpufreq/powernow.c +++ b/xen/arch/x86/acpi/cpufreq/powernow.c @@ -200,15 +200,17 @@ static int powernow_cpufreq_cpu_init(str perf =3D data->acpi_data; policy->shared_type =3D perf->shared_type; =20 - /* - * Will let policy->cpus know about dependency only when software - * coordination is required. - */ if (policy->shared_type =3D=3D CPUFREQ_SHARED_TYPE_ALL || policy->shared_type =3D=3D CPUFREQ_SHARED_TYPE_ANY) { - policy->cpus =3D perf->shared_cpu_map; + cpumask_set_cpu(cpu, &policy->cpus); + if (cpumask_weight(&policy->cpus) !=3D 1) { + printk(XENLOG_WARNING "Unsupported sharing type %d (%u = CPUs)\n", + policy->shared_type, cpumask_weight(&policy->cpus)); + result =3D -ENODEV; + goto err_unreg; + } } else { - policy->cpus =3D cpumask_of_cpu(cpu); =20 + cpumask_copy(&policy->cpus, cpumask_of(cpu)); } =20 /* capability check */ --- a/xen/include/acpi/cpufreq/processor_perf.h +++ b/xen/include/acpi/cpufreq/processor_perf.h @@ -29,7 +29,6 @@ struct processor_performance { uint32_t state_count; struct xen_processor_px *states; struct xen_psd_package domain_info; - cpumask_t shared_cpu_map; uint32_t shared_type; =20 uint32_t init; --=__PartC8E739EB.1__= Content-Type: text/plain; name="powernow-no-sharing.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="powernow-no-sharing.patch" c/s 20361:51b031b0737e removed the writing of struct=0Aprocessor_performanc= e's shared_cpu_map member, but the powernow driver=0Astill has code to = read it (though presumably that code path can't be=0Ataken on actual = hardware supported by the powernow driver except when=0Athe number of CPUs = to be coordinated is one). Remove the use of the=0Afield along with the = field itself.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/arch/x86/acpi/cpufreq/powernow.c=0A+++ b/xen/arch/x86/acpi/cpufreq/po= wernow.c=0A@@ -200,15 +200,17 @@ static int powernow_cpufreq_cpu_init(str= =0A perf =3D data->acpi_data;=0A policy->shared_type =3D perf->shar= ed_type;=0A =0A- /*=0A- * Will let policy->cpus know about = dependency only when software=0A- * coordination is required.=0A- = */=0A if (policy->shared_type =3D=3D CPUFREQ_SHARED_TYPE_ALL ||=0A = policy->shared_type =3D=3D CPUFREQ_SHARED_TYPE_ANY) {=0A- = policy->cpus =3D perf->shared_cpu_map;=0A+ cpumask_set_cpu(cpu, = &policy->cpus);=0A+ if (cpumask_weight(&policy->cpus) !=3D 1) {=0A+ = printk(XENLOG_WARNING "Unsupported sharing type %d (%u = CPUs)\n",=0A+ policy->shared_type, cpumask_weight(&policy= ->cpus));=0A+ result =3D -ENODEV;=0A+ goto err_unreg;= =0A+ }=0A } else {=0A- policy->cpus =3D cpumask_of_cpu(cp= u); =0A+ cpumask_copy(&policy->cpus, cpumask_of(cpu));=0A = }=0A =0A /* capability check */=0A--- a/xen/include/acpi/cpufreq/proces= sor_perf.h=0A+++ b/xen/include/acpi/cpufreq/processor_perf.h=0A@@ -29,7 = +29,6 @@ struct processor_performance {=0A uint32_t state_count;=0A = struct xen_processor_px *states;=0A struct xen_psd_package domain_info= ;=0A- cpumask_t shared_cpu_map;=0A uint32_t shared_type;=0A =0A = uint32_t init;=0A --=__PartC8E739EB.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=__PartC8E739EB.1__=--