Skip to contentSkip to conversation

fix off-by-one issues in blkiomon.h

PATCH New Martin Peschke 1 participant 1 message Apr 20, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix off-by-one issues in blkiomon.h

From: Martin Peschke <[email protected]>

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.

---
 stats.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
stats.h +2 -2
@@ -124,7 +124,7 @@ static inline void histlog2_merge(struct
 {
 	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 
 {
 	int i;
 
-	for (i = 0; i < h->num - 1; i++)
+	for (i = 0; i < h->num; i++)
 		a[i] = cpu_to_be32(a[i]);
 }