Commit 6d05e39d authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2019-11-25' into staging



Miscellaneous patches for 2019-11-25

# gpg: Signature made Mon 25 Nov 2019 06:00:24 GMT
# gpg:                using RSA key 354BC8B3D7EB2A6B68674E5F3870B400EB918653
# gpg:                issuer "armbru@redhat.com"
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2019-11-25:
  util/cutils: Fix incorrect integer->float conversion caught by clang

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 122e6d2a 25f74087
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -239,10 +239,12 @@ static int do_strtosz(const char *nptr, const char **end,
        goto out;
    }
    /*
     * Values >= 0xfffffffffffffc00 overflow uint64_t after their trip
     * through double (53 bits of precision).
     * Values near UINT64_MAX overflow to 2**64 when converting to double
     * precision.  Compare against the maximum representable double precision
     * value below 2**64, computed as "the next value after 2**64 (0x1p64) in
     * the direction of 0".
     */
    if ((val * mul >= 0xfffffffffffffc00) || val < 0) {
    if ((val * mul > nextafter(0x1p64, 0)) || val < 0) {
        retval = -ERANGE;
        goto out;
    }