To avoid a wrong compiler warning, use unitialized_var(cx) in xen_init_cpuid_mask. cx needn't be initialized for cpuid when ax is 1. Signed-off-by: Jiri Slaby <jirislaby at gmail.com> Cc: Jeremy Fitzhardinge <jeremy at xensource.com> Cc: Chris Wright <chrisw at sous-sol.org> --- arch/x86/xen/enlighten.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index e90540a..5ab75e2 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -202,7 +202,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, static __init void xen_init_cpuid_mask(void) { - unsigned int ax, bx, cx, dx; + unsigned int ax, bx, uninitialized_var(cx), dx; cpuid_leaf1_edx_mask ~((1 << X86_FEATURE_MCE) | /* disable MCE */ -- 1.6.3.3
Jeremy Fitzhardinge
2009-Aug-25 22:29 UTC
[PATCH 1/1] XEN: enlighten, use uninitialized_var(cx)
On 08/25/09 14:00, Jiri Slaby wrote:> To avoid a wrong compiler warning, use unitialized_var(cx) in > xen_init_cpuid_mask. > > cx needn't be initialized for cpuid when ax is 1. > > Signed-off-by: Jiri Slaby <jirislaby at gmail.com> > Cc: Jeremy Fitzhardinge <jeremy at xensource.com> > Cc: Chris Wright <chrisw at sous-sol.org> >Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge at citrix.com>> --- > arch/x86/xen/enlighten.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c > index e90540a..5ab75e2 100644 > --- a/arch/x86/xen/enlighten.c > +++ b/arch/x86/xen/enlighten.c > @@ -202,7 +202,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, > > static __init void xen_init_cpuid_mask(void) > { > - unsigned int ax, bx, cx, dx; > + unsigned int ax, bx, uninitialized_var(cx), dx; > > cpuid_leaf1_edx_mask > ~((1 << X86_FEATURE_MCE) | /* disable MCE */ >
* Jiri Slaby <jirislaby at gmail.com> wrote:> To avoid a wrong compiler warning, use unitialized_var(cx) in > xen_init_cpuid_mask. > > cx needn't be initialized for cpuid when ax is 1. > > Signed-off-by: Jiri Slaby <jirislaby at gmail.com> > Cc: Jeremy Fitzhardinge <jeremy at xensource.com> > Cc: Chris Wright <chrisw at sous-sol.org> > --- > arch/x86/xen/enlighten.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c > index e90540a..5ab75e2 100644 > --- a/arch/x86/xen/enlighten.c > +++ b/arch/x86/xen/enlighten.c > @@ -202,7 +202,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, > > static __init void xen_init_cpuid_mask(void) > { > - unsigned int ax, bx, cx, dx; > + unsigned int ax, bx, uninitialized_var(cx), dx;Please dont use uninitialized_var(), it's an unreliable facility: if this variable ever grows a real used-without-initialization bug in the future, the compiler warning is turned off permanently. It's rare but might happen. We are better off with initializing it to zero. Ingo