diff mbox series

x86: adjust comparison for earlier signedness change

Message ID e3d3de6d-2406-0655-ea3d-49a50570256b@suse.com (mailing list archive)
State New, archived
Headers show
Series x86: adjust comparison for earlier signedness change | expand

Commit Message

Jan Beulich Aug. 10, 2023, 2:59 p.m. UTC
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()")
Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Jürgen Groß Aug. 11, 2023, 6:50 a.m. UTC | #1
On 10.08.23 16:59, Jan Beulich wrote:
> 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()")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen
diff mbox series

Patch

--- a/xen/arch/x86/cpu/intel_cacheinfo.c
+++ b/xen/arch/x86/cpu/intel_cacheinfo.c
@@ -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 */