[PATCH stalld 45/52] stalld: fix format string type mismatch for time_t

Wander Lairson Costa <[email protected]> Mon, 8 Jun 2026 15:31:55 -0300
Newsgroups org.kernel.vger.linux-rt-users
Message-ID <[email protected]>
Several log statements print time_t differences using %d or %llu,
neither of which matches time_t on x86-64 where it is defined as
long. Use %ld throughout to match the actual type and eliminate
undefined behavior from format/argument mismatches.

Signed-off-by: Wander Lairson Costa <[email protected]>
---
 src/stalld.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/stalld.c b/src/stalld.c
index 1762033..5fade4f 100644
--- a/src/stalld.c
+++ b/src/stalld.c
@@ -649,7 +649,7 @@ int check_starving_tasks(struct cpu_info *cpu)
 		if ((get_monotonic_time() - task->since) < config_starving_threshold)
 			continue;
 
-		log_msg("%s-%d starved on CPU %d for %d seconds\n",
+		log_msg("%s-%d starved on CPU %d for %ld seconds\n",
 			task->comm, task->pid, cpu->id,
 			(get_monotonic_time() - task->since));
 
@@ -695,7 +695,7 @@ int check_might_starve_tasks(struct cpu_info *cpu)
 
 		if ((get_monotonic_time() - task->since) >= config_starving_threshold/2) {
 
-			log_msg("%s-%d might starve on CPU %d (waiting for %d seconds)\n",
+			log_msg("%s-%d might starve on CPU %d (waiting for %ld seconds)\n",
 				task->comm, task->pid, cpu->id,
 				(get_monotonic_time() - task->since));
 
@@ -944,7 +944,7 @@ int boost_cpu_starving_vector(struct cpu_starving_task_info *vector, int nr_cpus
 		cpu = &cpu_starving_vector[i];
 
 		if (cpu->pid)
-			log_verbose("\t cpu %d: pid: %d starving for %llu\n",
+			log_verbose("\t cpu %d: pid: %d starving for %ld\n",
 				    i, cpu->pid, (now - cpu->since));
 
 		/* Skip if no task or not starving long enough */
@@ -953,7 +953,7 @@ int boost_cpu_starving_vector(struct cpu_starving_task_info *vector, int nr_cpus
 
 		/* Log when task has reached starvation threshold */
 		if ((now - cpu->since) >= config_starving_threshold) {
-			log_msg("%s-%d starved on CPU %d for %d seconds\n",
+			log_msg("%s-%d starved on CPU %d for %ld seconds\n",
 				cpu->task.comm, cpu->pid, i,
 				(now - cpu->since));
 		}
-- 
2.54.0