Fix off-by-one in io_u_plat[] array sizing
authorJens Axboe <jaxboe@fusionio.com>
Mon, 15 Aug 2011 07:00:28 +0000 (09:00 +0200)
committerJens Axboe <jaxboe@fusionio.com>
Mon, 15 Aug 2011 07:00:28 +0000 (09:00 +0200)
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
fio.h
stat.c

diff --git a/fio.h b/fio.h
index 67663515ee9a939089b77141a703f6c3b20bf3ab..c74116257571b2cc6815b8261beede44f8cf4a29 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -217,7 +217,7 @@ struct thread_stat {
        unsigned int io_u_complete[FIO_IO_U_MAP_NR];
        unsigned int io_u_lat_u[FIO_IO_U_LAT_U_NR];
        unsigned int io_u_lat_m[FIO_IO_U_LAT_M_NR];
-       unsigned int io_u_plat [2][FIO_IO_U_PLAT_NR];
+       unsigned int io_u_plat[3][FIO_IO_U_PLAT_NR];
        unsigned long total_io_u[3];
        unsigned long short_io_u[3];
        unsigned long total_submit;
diff --git a/stat.c b/stat.c
index 25dd1791767437ad75de4b405b63d37debb487b6..ee6ee51ec1553550322f0e8e9377b069127427ce 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -773,10 +773,11 @@ void show_run_stats(void)
 
 
                for (k = 0; k <= 2; k++) {
+                       int m;
+
                        ts->total_io_u[k] += td->ts.total_io_u[k];
                        ts->short_io_u[k] += td->ts.short_io_u[k];
 
-                       int m;
                        for (m = 0; m < FIO_IO_U_PLAT_NR; m++)
                                ts->io_u_plat[k][m] += td->ts.io_u_plat[k][m];
                }