[systemd-devel] [PATCH] bootchart: svg: fix checking of list end

Aaro Koskinen aaro.koskinen at nokia.com
Tue Feb 24 08:32:31 PST 2015


If we have less samples than expected, systemd-bootchart will crash.

Signed-off-by: Aaro Koskinen <aaro.koskinen at nokia.com>
---
 src/bootchart/svg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c
index e111fa9..144177c 100644
--- a/src/bootchart/svg.c
+++ b/src/bootchart/svg.c
@@ -1170,7 +1170,7 @@ static void svg_ps_bars(void) {
 
                 ps->sample = ps->sample->next;
                 sample_hz = ps->sample;
-                for (ii=0;((ii<(int)arg_hz/2)&&(ps->sample->next));ii++)
+                for (ii=0;((ii<(int)arg_hz/2)&&(sample_hz->next));ii++)
                         sample_hz = sample_hz->next;
 
                 /* subtract bootchart cpu utilization from total */
-- 
2.1.2



More information about the systemd-devel mailing list