[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86: adjust comparison for earlier signedness change


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 10 Aug 2023 16:59:05 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+rYYKw0tV9x7V2m5N+9V7884IoTi9TEJZdeF+fwU9UE=; b=fLt+kA/HKLYGnp7prdqwPmpdISmFoPM7uurP+ocxBGGUpB4oH9MVeCII3FhSaHP2Gt6X2+Owds82wIj9l4hNaK/AvWF2teXySxOEl2S1PNsSM8Vnm3phFBjZcauX7lzGg9sdBN/MIFc9/OdEEKjjmvP2UBuFyti7E5q2zdyZu10WtmFI+Bv4lMfCjAr142ZsMgFk94fNrnKujYayN+EalKbPIcAqiDndu1exwWwgQRDd35Xhx7ZJA6/Zsf7E/ZKhzVkY/ORPNVqV6tgVK5kUCj88Bi0yqn/HNBmzavd9vnfDAz7G6tYjV1j/HVtDOsIYBMCK5yjNMnZugDxx/fmkmA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMiA8hn2N1gF4hQnf8EoQYqomciQf7SEwDwC0/mS7Ht7SHufH3ZE32tgMgXJMzE7yfskRv3VVjZ4qwJMphnAKsWTvLmezqywM/lGLSA+z6iIUiNZR1G3T0JNHJxgX2IeBAQQX+cNurN5kZBHetfYldrmb/VfsZ5OC3SWOxQw46Og1aOIrZHeH9sd2yGaTOKhmV0fZt+O9uqpUEJAf5YO1jB3Vu2cUYflDrmfxAMtgZUSObL5f2IsDOxCrIPbeGh4KlQ6FUC4YV8MQo66hZORwABbohjlGp4xnd+tH0JnfOdvUdT2HdvkypNro0aob8XVhp/8NhPaBEp4UzDgdqrCdw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Thu, 10 Aug 2023 15:00:00 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxx>

--- 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 */



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.