Skip to contentSkip to conversation

x86: adjust comparison for earlier signedness change

PATCH In review Jan Beulich 2 participants 2 messages Aug 10, 2023 – Aug 11, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: adjust comparison for earlier signedness change

Interestingly only Clang warns about the now bogus less-than-zero comparison. Convert it to something that's more explicitly doing what the comment says.

Fixes 4086857cc159 ("x86: implement cpuid() in terms of cpuid_count()")
xen/arch/x86/cpu/intel_cacheinfo.c +2 -1
@@ -187,7 +187,8 @@ void init_intel_cacheinfo(struct cpuinfo
 
 			/* If bit 31 is set, this is an unknown format */
 			for ( j = 0 ; j < 3 ; j++ ) {
-				if ( regs[j] < 0 ) regs[j] = 0;
+				if ( regs[j] >> 31 )
+					regs[j] = 0;
 			}
 
 			/* Byte 0 is level count, not a descriptor */