cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
26ba25
From e851c8ce61bd343961c59afee9062d04a880b1d6 Mon Sep 17 00:00:00 2001
26ba25
From: David Hildenbrand <david@redhat.com>
26ba25
Date: Fri, 21 Dec 2018 15:36:14 +0000
26ba25
Subject: [PATCH 12/22] hw/s390x: Fix bad mask in time2tod()
26ba25
26ba25
RH-Author: David Hildenbrand <david@redhat.com>
26ba25
Message-id: <20181221153614.27961-13-david@redhat.com>
26ba25
Patchwork-id: 83756
26ba25
O-Subject: [RHEL-8.0 qemu-kvm v2 PATCH 12/12] hw/s390x: Fix bad mask in time2tod()
26ba25
Bugzilla: 1653569
26ba25
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
26ba25
RH-Acked-by: Thomas Huth <thuth@redhat.com>
26ba25
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
26ba25
26ba25
Since "s390x/tcg: avoid overflows in time2tod/tod2time", the
26ba25
time2tod() function tries to deal with the 9 uppermost bits in the
26ba25
time value, but uses the wrong mask for this: 0xff80000000000000 should
26ba25
be used instead of 0xff10000000000000 here.
26ba25
26ba25
Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
26ba25
Cc: qemu-stable@nongnu.org
26ba25
Signed-off-by: Thomas Huth <thuth@redhat.com>
26ba25
Message-Id: <1544792887-14575-1-git-send-email-thuth@redhat.com>
26ba25
Reviewed-by: David Hildenbrand <david@redhat.com>
26ba25
[CH: tweaked commit message]
26ba25
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
26ba25
(cherry picked from commit aba7a5a2de3dba5917024df25441f715b9249e31)
26ba25
Signed-off-by: David Hildenbrand <david@redhat.com>
26ba25
26ba25
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
26ba25
---
26ba25
 include/hw/s390x/tod.h | 2 +-
26ba25
 1 file changed, 1 insertion(+), 1 deletion(-)
26ba25
26ba25
diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
26ba25
index cbd7552..47ef9de 100644
26ba25
--- a/include/hw/s390x/tod.h
26ba25
+++ b/include/hw/s390x/tod.h
26ba25
@@ -56,7 +56,7 @@ typedef struct S390TODClass {
26ba25
 /* Converts ns to s390's clock format */
26ba25
 static inline uint64_t time2tod(uint64_t ns)
26ba25
 {
26ba25
-    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
26ba25
+    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
26ba25
 }
26ba25
 
26ba25
 /* Converts s390's clock format to ns */
26ba25
-- 
26ba25
1.8.3.1
26ba25