Skip to contentSkip to conversation

x86/cpuid: Fix build with CentOS 6 following c/s 7479151106

PATCH In review Andrew Cooper 2 participants 2 messages Sep 9, 2019 – Sep 10, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/cpuid: Fix build with CentOS 6 following c/s 7479151106

GCC of a CentOS 6 vintage complains:

cpuid.c: In function 'parse_xen_cpuid':
cpuid.c:32: error: 'mid' may be used uninitialized in this function

This can't occur in practice because the while() loop is guarenteed to be entered, but initialise mid to work around the issues.

Spotted by Gitlab CI.

---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/cpuid.c +1 -1
index 36b1e2ce4c..acba0f7583 100644
@@ -29,7 +29,7 @@ static int __init parse_xen_cpuid(const char *s)
             const char *name;
             unsigned int bit;
         } features[] __initconstrel = INIT_FEATURE_NAMES;
-        const struct feature *lhs, *mid, *rhs;
+        const struct feature *lhs, *rhs, *mid = NULL /* GCC... */;
         const char *feat;
 
         ss = strchr(s, ',');
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Andrew Cooper

GCC of a CentOS 6 vintage complains:

cpuid.c: In function 'parse_xen_cpuid':
cpuid.c:32: error: 'mid' may be used uninitialized in this function

This can't occur in practice because the while() loop is guarenteed to be entered, but initialise mid to work around the issues.

Spotted by Gitlab CI.

Ah, yes, thanks. I too had noticed this yesterday, but didn't get around to check what the correct workaround would be.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel