@cryptotaxi247 / netdata-1 / commits / 548489555

Fix coverity issues (#16589)

* Fix coverity issues * More issues fixed

Stelios Fragkakis committed Dec 13, 2023 at 16:24 UTC 548489555bbdadc7274a2165f365b968992b98da
6 files changed +11 -11
database/engine/journalfile.c
+1 -1
@@ -1008,7 +1008,7 @@ void journalfile_v2_populate_retention_to_mrg(struct rrdengine_instance *ctx, st
1008 time_t end_time_s = header_start_time_s + metric->delta_end_s;
1009
1010 mrg_update_metric_retention_and_granularity_by_uuid(
1011 - main_mrg, (Word_t)ctx, &metric->uuid, start_time_s, end_time_s, (time_t) metric->update_every_s, now_s);
1011 + main_mrg, (Word_t)ctx, &metric->uuid, start_time_s, end_time_s, metric->update_every_s, now_s);
1012
1013 metric++;
1014 }
database/engine/metric.c
+2 -2
@@ -586,7 +586,7 @@ inline bool mrg_metric_clear_writer(MRG *mrg, METRIC *metric) {
586 inline void mrg_update_metric_retention_and_granularity_by_uuid(
587 MRG *mrg, Word_t section, uuid_t *uuid,
588 time_t first_time_s, time_t last_time_s,
589 - time_t update_every_s, time_t now_s)
589 + uint32_t update_every_s, time_t now_s)
590 {
591 if(unlikely(last_time_s > now_s)) {
592 nd_log_limit_static_global_var(erl, 1, 0);
@@ -623,7 +623,7 @@ inline void mrg_update_metric_retention_and_granularity_by_uuid(
623 .section = section,
624 .first_time_s = first_time_s,
625 .last_time_s = last_time_s,
626 - .latest_update_every_s = (uint32_t) update_every_s
626 + .latest_update_every_s = update_every_s
627 };
628 metric = mrg_metric_add_and_acquire(mrg, entry, &added);
629 }
database/engine/metric.h
+1 -1
@@ -89,6 +89,6 @@ size_t mrg_aral_overhead(void);
89 void mrg_update_metric_retention_and_granularity_by_uuid(
90 MRG *mrg, Word_t section, uuid_t *uuid,
91 time_t first_time_s, time_t last_time_s,
92 - time_t update_every_s, time_t now_s);
92 + uint32_t update_every_s, time_t now_s);
93
94 #endif // DBENGINE_METRIC_H
database/engine/pagecache.c
+3 -3
@@ -222,7 +222,7 @@ static size_t get_page_list_from_pgc(PGC *cache, METRIC *metric, struct rrdengin
222 Word_t metric_id = mrg_metric_id(main_mrg, metric);
223
224 time_t now_s = wanted_start_time_s;
225 - time_t dt_s = mrg_metric_get_update_every_s(main_mrg, metric);
225 + uint32_t dt_s = mrg_metric_get_update_every_s(main_mrg, metric);
226
227 if(!dt_s)
228 dt_s = default_rrd_update_every;
@@ -547,7 +547,7 @@ static size_t get_page_list_from_journal_v2(struct rrdengine_instance *ctx, METR
547 if(prc == PAGE_IS_IN_THE_FUTURE)
548 break;
549
550 - time_t page_update_every_s = page_entry_in_journal->update_every_s;
550 + uint32_t page_update_every_s = page_entry_in_journal->update_every_s;
551 size_t page_length = page_entry_in_journal->page_length;
552
553 if(datafile_acquire(datafile, DATAFILE_ACQUIRE_OPEN_CACHE)) { //for open cache item
@@ -567,7 +567,7 @@ static size_t get_page_list_from_journal_v2(struct rrdengine_instance *ctx, METR
567 .metric_id = metric_id,
568 .start_time_s = page_first_time_s,
569 .end_time_s = page_last_time_s,
570 - .update_every_s = (uint32_t) page_update_every_s,
570 + .update_every_s = page_update_every_s,
571 .data = datafile,
572 .size = 0,
573 .custom_data = (uint8_t *) &ei,
database/engine/pdc.c
+3 -3
@@ -790,7 +790,7 @@ VALIDATED_PAGE_DESCRIPTOR validate_page(
790 nd_log_limit(&erl, NDLS_DAEMON, NDLP_ERR,
791 #endif
792 "DBENGINE: metric '%s' %s invalid page of type %u "
793 - "from %ld to %ld (now %ld), update every %ld, page length %zu, entries %zu (flags: %s)",
793 + "from %ld to %ld (now %ld), update every %u, page length %zu, entries %zu (flags: %s)",
794 uuid_str, msg, vd.type,
795 vd.start_time_s, vd.end_time_s, now_s, vd.update_every_s, vd.page_length, vd.entries, wb?buffer_tostring(wb):""
796 );
@@ -810,9 +810,9 @@ VALIDATED_PAGE_DESCRIPTOR validate_page(
810 nd_log_limit(&erl, NDLS_DAEMON, NDLP_ERR,
811 #endif
812 "DBENGINE: metric '%s' %s page of type %u "
813 - "from %ld to %ld (now %ld), update every %ld, page length %zu, entries %zu (flags: %s), "
813 + "from %ld to %ld (now %ld), update every %u, page length %zu, entries %zu (flags: %s), "
814 "found inconsistent - the right is "
815 - "from %ld to %ld, update every %ld, page length %zu, entries %zu: "
815 + "from %ld to %ld, update every %u, page length %zu, entries %zu: "
816 "%s%s%s%s%s%s%s",
817 uuid_str, msg, vd.type,
818 start_time_s, end_time_s, now_s, update_every_s, page_length, entries, wb?buffer_tostring(wb):"",
database/engine/rrdengineapi.c
+1 -1
@@ -199,7 +199,7 @@ static inline void check_and_fix_mrg_update_every(struct rrdeng_collect_handle *
199 if(unlikely(!handle->update_every_ut))
200 handle->update_every_ut = (usec_t)mrg_metric_get_update_every_s(main_mrg, handle->metric) * USEC_PER_SEC;
201 else
202 - mrg_metric_set_update_every(main_mrg, handle->metric, (time_t)(handle->update_every_ut / USEC_PER_SEC));
202 + mrg_metric_set_update_every(main_mrg, handle->metric, (uint32_t)(handle->update_every_ut / USEC_PER_SEC));
203 }
204 }
205