Blame SOURCES/0020-helper-Fix-KVM-signature.patch

6f448a
From e0443f1fc78f2a79c073dbdf4133bec41c4c0591 Mon Sep 17 00:00:00 2001
6f448a
From: "Richard W.M. Jones" <rjones@redhat.com>
6f448a
Date: Fri, 4 Oct 2019 18:30:01 +0100
6f448a
Subject: [PATCH 20/21] helper: Fix KVM signature.
6f448a
6f448a
Thanks: Paolo Bonzini.
6f448a
---
6f448a
 virt-what-cpuid-helper.c | 9 +++++----
6f448a
 1 file changed, 5 insertions(+), 4 deletions(-)
6f448a
6f448a
diff --git a/virt-what-cpuid-helper.c b/virt-what-cpuid-helper.c
6f448a
index 0cd4a6f..9c6cdb2 100644
6f448a
--- a/virt-what-cpuid-helper.c
6f448a
+++ b/virt-what-cpuid-helper.c
6f448a
@@ -28,15 +28,16 @@
6f448a
 #if defined(__i386__) || defined(__x86_64__)
6f448a
 
6f448a
 /* Known x86 hypervisor signatures.  Note that if you add a new test
6f448a
- * to virt-what.in you may need to update this list.  The signature is
6f448a
- * always 12 bytes except in the case of KVM.
6f448a
+ * to virt-what.in you may need to update this list.  Note the
6f448a
+ * signature is always 12 bytes long, plus we add \0 to the end to
6f448a
+ * make it 13 bytes.
6f448a
  */
6f448a
 static int
6f448a
-known_signature (char *sig)
6f448a
+known_signature (const char *sig)
6f448a
 {
6f448a
   return
6f448a
     strcmp (sig, "bhyve bhyve ") == 0 ||
6f448a
-    strcmp (sig, "KVMKVMKVM") == 0 ||
6f448a
+    memcmp (sig, "KVMKVMKVM\0\0\0", 12) == 0 ||
6f448a
     strcmp (sig, "LKVMLKVMLKVM") == 0 ||
6f448a
     strcmp (sig, "Microsoft Hv") == 0 ||
6f448a
     strcmp (sig, "OpenBSDVMM58") == 0 ||
6f448a
-- 
6f448a
2.23.0
6f448a