]> arthur.barton.de Git - netdata.git/commitdiff
Merge pull request #1978 from ktsaou/master
authorCosta Tsaousis <costa@tsaousis.gr>
Sun, 19 Mar 2017 10:16:10 +0000 (12:16 +0200)
committerGitHub <noreply@github.com>
Sun, 19 Mar 2017 10:16:10 +0000 (12:16 +0200)
freebsd coverity fixes

src/adaptive_resortable_list.c
src/freebsd_sysctl.c

index 7ae8ba1459f2c0eef7d64c0e7cd2aa14674c1cf0..f74c53eae5e192845ae57ed7975eb3ee9d8d5034 100644 (file)
@@ -233,9 +233,14 @@ int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *val
         if(base->head == base->next_keyword)
             base->head = e;
     }
-    else
+    else {
         e->prev = NULL;
 
+        if(!base->head)
+            base->head = e;
+    }
+
+    // prepare the next iteration
     base->next_keyword = e->next;
     if(unlikely(!base->next_keyword))
         base->next_keyword = base->head;
index 37fc8e5242b69ee2f1ad2c607d313e7cd1983cd2..8fc851481ea292b326c7488b85d40693533b3661 100644 (file)
@@ -380,7 +380,7 @@ int do_kern_cp_times(int update_every, usec_t dt) {
 
 int do_hw_intcnt(int update_every, usec_t dt) {
     static int mib_hw_intrcnt[2] = {0, 0};
-    size_t intrcnt_size;
+    size_t intrcnt_size = sizeof(mib_hw_intrcnt);
     int i;
 
     if (unlikely(GETSYSCTL_SIZE("hw.intrcnt", mib_hw_intrcnt, intrcnt_size))) {
@@ -1241,7 +1241,7 @@ int do_net_isr(int update_every, usec_t dt) {
     static int mib_workstream[3] = {0, 0, 0}, mib_work[3] = {0, 0, 0};
     int common_error = 0;
     int i, n;
-    size_t netisr_workstream_size, netisr_work_size;
+    size_t netisr_workstream_size = sizeof(mib_workstream), netisr_work_size = sizeof(mib_work);
     unsigned long num_netisr_workstreams = 0, num_netisr_works = 0;
     static struct sysctl_netisr_workstream *netisr_workstream = NULL;
     static struct sysctl_netisr_work *netisr_work = NULL;
@@ -3476,7 +3476,7 @@ int do_kern_devstat(int update_every, usec_t dt) {
                     }
 
                     if (unlikely(!enable_pass_devices))
-                        if (dstat[i].device_type & DEVSTAT_TYPE_PASS == DEVSTAT_TYPE_PASS)
+                        if ((dstat[i].device_type & DEVSTAT_TYPE_PASS) == DEVSTAT_TYPE_PASS)
                             continue;
 
                     if (((dstat[i].device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_DIRECT) || ((dstat[i].device_type & DEVSTAT_TYPE_MASK) == DEVSTAT_TYPE_STORARRAY)) {