XEN: enlighten, use uninitialized_var(cx)
Subsystems (3)
PATCH 1/1 XEN: enlighten, use uninitialized_var(cx)
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.
--- arch/x86/xen/enlighten.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/xen/enlighten.c +1 -1
@@ -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 */
Signature · 1 line
1.6.3.3
Quoted 9 lines · Jiri Slaby
To avoid a wrong compiler warning, use
unitialized_var(cx)inxen_init_cpuid_mask.cx needn't be initialized for cpuid when ax is 1.
Signed-off-by Jiri Slaby <[email protected]>Cc Jeremy Fitzhardinge <[email protected]>Cc Chris Wright <[email protected]>
Quoted 18 lines
--- arch/x86/xen/enlighten.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/x86/xen/enlighten.c +1
-1@@ -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 */
Quoted 17 lines · Jiri Slaby
To avoid a wrong compiler warning, use
unitialized_var(cx)inxen_init_cpuid_mask.cx needn't be initialized for cpuid when ax is 1.
Signed-off-by Jiri Slaby <[email protected]>Cc Jeremy Fitzhardinge <[email protected]>Cc Chris Wright <[email protected]>--- arch/x86/xen/enlighten.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/x86/xen/enlighten.c +0
-0
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 205
Quoted 5 lines
arch/x86/xen/enlighten.c +1
-1@@ -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
H. Peter Anvin
reviewerQuoted 7 lines · Ingo Molnar
Quoted 7 lines
arch/x86/xen/enlighten.c +0
-0@@ -202,7 +202,7 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx,
Quoted 11 lines
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 205
Quoted 4 lines
arch/x86/xen/enlighten.c +1
-1static __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.
I hadn't seen this thread, but I pushed a patch to x86/urgent to do exactly that while I was committing the Xen crash patch last night.
-hpa
Signature · 2 lines
H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.