[PATCH] x86: adjust comparison for earlier signedness change

Jan Beulich posted 1 patch 8 months, 3 weeks ago
Failed in applying to current master (apply log)
[PATCH] x86: adjust comparison for earlier signedness change
Posted by Jan Beulich 8 months, 3 weeks ago
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>

--- 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 */
Re: [PATCH] x86: adjust comparison for earlier signedness change
Posted by Juergen Gross 8 months, 2 weeks ago
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