summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2025-08-23 11:01:57 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2025-08-23 14:11:39 +0200
commit6292bbbd245cb64a346f5126670085e656e89a88 (patch)
tree077b7132ad487b4fc40637093d8b29997faae6d0
parent047f4ed6c188de4e874895a6818c09f2460322bd (diff)
downloadouroboros-6292bbbd245cb64a346f5126670085e656e89a88.tar.gz
ouroboros-6292bbbd245cb64a346f5126670085e656e89a88.zip
build: Add some hints for scan-build
The scan-build tool was pointing out some potential issues that were understood or false positives. Added some asserts so scan-build can complete successfully without these warnings. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
-rw-r--r--src/ipcpd/unicast/dir/dht.c3
-rw-r--r--src/lib/tpm.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/ipcpd/unicast/dir/dht.c b/src/ipcpd/unicast/dir/dht.c
index 656b8b94..858fad0b 100644
--- a/src/ipcpd/unicast/dir/dht.c
+++ b/src/ipcpd/unicast/dir/dht.c
@@ -1450,6 +1450,7 @@ static ssize_t dht_kv_wait_req(const uint8_t * key,
return i;
no_vals:
pthread_mutex_unlock(&dht.reqs.mtx);
+ *vals = NULL;
return 0;
fail_val_data:
freebufs(*vals, i);
@@ -3285,6 +3286,8 @@ uint64_t dht_query(const uint8_t * key)
}
if (n == 0) {
+ assert(vals == NULL);
+
log_dbg(KEY_FMT " No local values.", KEY_VAL(key));
n = dht_kv_query_remote(key, &vals, NULL);
if (n < 0) {
diff --git a/src/lib/tpm.c b/src/lib/tpm.c
index 52c28de7..7a17ef6b 100644
--- a/src/lib/tpm.c
+++ b/src/lib/tpm.c
@@ -95,6 +95,9 @@ static void tpm_debug_thread(struct pthr_el * e)
diff = ts_diff_ms(&now, &e->start) / 1000;
intv = ts_diff_ms(&now, &e->last) / 1000;
+ (void) diff; /* Never read if both build options off (0) */
+ (void) intv; /* Never read if report option off (0) */
+
if (BETWEEN(TPM_DEBUG_REPORT_INTERVAL, 0, intv)) {
log_dbg("Thread %d:%lx running for %ld s.\n",
getpid(),e->thr, diff);