From b5f8804a588fffdea10a0cd46a36fc196acea9f2 Mon Sep 17 00:00:00 2001 From: Martin Peschke Date: Mon, 20 Apr 2009 16:07:11 +0200 Subject: [PATCH] fix off-by-one issues in blkiomon.h Fix two off-by-one issues. Last bucket of histogram was ommitted by mistake when being converted to big-endian or when being merged with another bucket. Signed-off-by: Martin Peschke Signed-off-by: Jens Axboe --- stats.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stats.h b/stats.h index e519af4..fdedf27 100644 --- a/stats.h +++ b/stats.h @@ -124,7 +124,7 @@ static inline void histlog2_merge(struct histlog2 *h, __u32 *dst, __u32 *src) { int i; - for (i = 0; i < h->num - 1; i++) + for (i = 0; i < h->num; i++) dst[i] += src[i]; } @@ -132,7 +132,7 @@ static inline void histlog2_to_be(__u32 a[], struct histlog2 *h) { int i; - for (i = 0; i < h->num - 1; i++) + for (i = 0; i < h->num; i++) a[i] = cpu_to_be32(a[i]); } -- 2.25.1