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

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