Commit aba7a5a2 authored by Thomas Huth's avatar Thomas Huth Committed by Cornelia Huck
Browse files

hw/s390x: Fix bad mask in time2tod()



Since "s390x/tcg: avoid overflows in time2tod/tod2time", the
time2tod() function tries to deal with the 9 uppermost bits in the
time value, but uses the wrong mask for this: 0xff80000000000000 should
be used instead of 0xff10000000000000 here.

Fixes: 14055ce5
Cc: qemu-stable@nongnu.org
Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
Message-Id: <1544792887-14575-1-git-send-email-thuth@redhat.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
[CH: tweaked commit message]
Signed-off-by: default avatarCornelia Huck <cohuck@redhat.com>
parent 55281a2c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ typedef struct S390TODClass {
/* Converts ns to s390's clock format */
static inline uint64_t time2tod(uint64_t ns)
{
    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
}

/* Converts s390's clock format to ns */