From 7c883a9412d9dad32c23084c86272602bb7ffd5c Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Thu, 4 Apr 2013 06:18:24 -0400 Subject: [PATCH] iowatcher: Do not add events out of time range to the plot If the event is out of time range that should be plotted, do not add it. It will corrupt memory... Signed-off-by: Jan Kara Signed-off-by: Chris Mason --- iowatcher/plot.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/iowatcher/plot.c b/iowatcher/plot.c index 6d652dd..e187685 100644 --- a/iowatcher/plot.c +++ b/iowatcher/plot.c @@ -206,8 +206,10 @@ void set_gdd_bit(struct graph_dot_data *gdd, u64 offset, double bytes, double ti if (offset > gdd->max_offset || offset < gdd->min_offset) return; - gdd->total_ios++; time = time / 1000000000.0; + if (time < gdd->min_seconds || time > gdd->max_seconds) + return; + gdd->total_ios++; while (bytes > 0 && offset <= gdd->max_offset) { row = (double)(offset - gdd->min_offset) / bytes_per_row; col = (time - gdd->min_seconds) / secs_per_col; -- 2.25.1