[systemd-commits] 2 commits - src/bootchart

Tom Gundersen tomegun at kemper.freedesktop.org
Tue Sep 16 11:26:13 PDT 2014


 src/bootchart/store.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit d498a616075ebfd8025d66c4c4f725d24eb3aca3
Author: Andreas Henriksson <andreas at fatal.se>
Date:   Tue Sep 16 19:40:25 2014 +0200

    bootchart: oom-check correct variable
    
    Coverity warned that we have already dereferenced ps->sample before
    null-checking it. I suspect that's not really the issue and that
    the check is checking the wrong variable.
    Likely the oom-check should be on the just allocated ps->sample->next.
    
    Found by coverity. Fixes: CID#1237765

diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index ed46a50..ed683e8 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -399,7 +399,7 @@ schedstat_next:
                         continue;
 
                 ps->sample->next = new0(struct ps_sched_struct, 1);
-                if (!ps->sample) {
+                if (!ps->sample->next) {
                         log_oom();
                         exit(EXIT_FAILURE);
                 }

commit e10f3c431a3bc1a94fbe9d2a14d3025550f9672e
Author: Tom Gundersen <teg at jklm.no>
Date:   Tue Sep 16 18:42:22 2014 +0200

    bootchart: use safe_atod() rather than strtod()

diff --git a/src/bootchart/store.c b/src/bootchart/store.c
index 2d2ea42..ed46a50 100644
--- a/src/bootchart/store.c
+++ b/src/bootchart/store.c
@@ -251,6 +251,7 @@ schedstat_next:
                         _cleanup_fclose_ FILE *st = NULL;
                         char t[32];
                         struct ps_struct *parent;
+                        int r;
 
                         ps->next_ps = new0(struct ps_struct, 1);
                         if (!ps->next_ps) {
@@ -310,7 +311,11 @@ schedstat_next:
                         if (!sscanf(m, "%*s %*s %s", t))
                                 continue;
 
-                        ps->starttime = strtod(t, NULL) / 1000.0;
+                        r = safe_atod(t, &ps->starttime);
+                        if (r < 0)
+                                continue;
+
+                        ps->starttime /= 1000.0;
 
                         if (arg_show_cgroup)
                                 /* if this fails, that's OK */



More information about the systemd-commits mailing list