923a60
From 93ac68f5225bc0cf63ead3a3212539586d1fffb7 Mon Sep 17 00:00:00 2001
923a60
From: Aaro Koskinen <aaro.koskinen@nokia.com>
923a60
Date: Tue, 24 Feb 2015 18:32:31 +0200
923a60
Subject: [PATCH] bootchart: svg: fix checking of list end
923a60
923a60
If we have less samples than expected, systemd-bootchart will crash.
923a60
923a60
(cherry picked from commit c1682f17a0c966988e865c649e565dae41abf32d)
923a60
---
923a60
 src/bootchart/svg.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
923a60
index e111fa9cce..144177cd47 100644
923a60
--- a/src/bootchart/svg.c
923a60
+++ b/src/bootchart/svg.c
923a60
@@ -1170,7 +1170,7 @@ static void svg_ps_bars(void) {
923a60
 
923a60
                 ps->sample = ps->sample->next;
923a60
                 sample_hz = ps->sample;
923a60
-                for (ii=0;((ii<(int)arg_hz/2)&&(ps->sample->next));ii++)
923a60
+                for (ii=0;((ii<(int)arg_hz/2)&&(sample_hz->next));ii++)
923a60
                         sample_hz = sample_hz->next;
923a60
 
923a60
                 /* subtract bootchart cpu utilization from total */