Fix overflow in percentile calculation for Windows
authorAndrzej Jakowski <andrzej.jakowski@intel.com>
Wed, 11 Oct 2017 22:26:00 +0000 (16:26 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 11 Oct 2017 22:26:00 +0000 (16:26 -0600)
This patch fixes percentile calculation for Windows where overflow
on 32 bit type happened while calculating actual percentiles.

Signed-off-by: Andrzej Jakowski <andrzej.jakowski@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
stat.c

diff --git a/stat.c b/stat.c
index c5a68ad5c489cb0baf083220edbd63c4d2bcf591..5c75868051857582d0e0152287bc37260ace6340 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -139,7 +139,7 @@ unsigned int calc_clat_percentiles(unsigned int *io_u_plat, unsigned long nr,
                                   fio_fp64_t *plist, unsigned long long **output,
                                   unsigned long long *maxv, unsigned long long *minv)
 {
                                   fio_fp64_t *plist, unsigned long long **output,
                                   unsigned long long *maxv, unsigned long long *minv)
 {
-       unsigned long sum = 0;
+       unsigned long long sum = 0;
        unsigned int len, i, j = 0;
        unsigned int oval_len = 0;
        unsigned long long *ovals = NULL;
        unsigned int len, i, j = 0;
        unsigned int oval_len = 0;
        unsigned long long *ovals = NULL;