Skip to content

Commit

Permalink
util/stats64: Fix min/max comparisons
Browse files Browse the repository at this point in the history
stat64_min_slow() and stat64_max_slow() compare the wrong way.  This
makes iotest 136 fail with clang and -m32.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20171114232223.25207-1-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 26a5db3)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
XanClic authored and mdroth committed Dec 6, 2017
1 parent 56a10ff commit d6c99e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions util/stats64.c
Expand Up @@ -91,7 +91,7 @@ bool stat64_min_slow(Stat64 *s, uint64_t value)
low = atomic_read(&s->low);

orig = ((uint64_t)high << 32) | low;
if (orig < value) {
if (value < orig) {
/* We have to set low before high, just like stat64_min reads
* high before low. The value may become higher temporarily, but
* stat64_get does not notice (it takes the lock) and the only ill
Expand Down Expand Up @@ -120,7 +120,7 @@ bool stat64_max_slow(Stat64 *s, uint64_t value)
low = atomic_read(&s->low);

orig = ((uint64_t)high << 32) | low;
if (orig > value) {
if (value > orig) {
/* We have to set low before high, just like stat64_max reads
* high before low. The value may become lower temporarily, but
* stat64_get does not notice (it takes the lock) and the only ill
Expand Down

0 comments on commit d6c99e8

Please sign in to comment.