[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251124104401.374856-1-mrout@redhat.com>
Date: Mon, 24 Nov 2025 16:13:58 +0530
From: Malaya Kumar Rout <mrout@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: mrout@...hat.com,
malayarout91@...il.com,
"Rafael J. Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Zhang Rui <rui.zhang@...el.com>,
Lukasz Luba <lukasz.luba@....com>,
linux-pm@...r.kernel.org
Subject: [PATCH] tools/thermal/thermal-engine: Fix format string bug in thermal-engine
The error message in the daemon() failure path uses %p format specifier
without providing a corresponding pointer argument, resulting in undefined
behavior and printing garbage values.
Replace %p with %m to properly print the errno error message, which is
the intended behavior when daemon() fails.
This fix ensures proper error reporting when daemonization fails.
Signed-off-by: Malaya Kumar Rout <mrout@...hat.com>
---
tools/thermal/thermal-engine/thermal-engine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/thermal/thermal-engine/thermal-engine.c b/tools/thermal/thermal-engine/thermal-engine.c
index 0764dc754771..66b0ba1fcd23 100644
--- a/tools/thermal/thermal-engine/thermal-engine.c
+++ b/tools/thermal/thermal-engine/thermal-engine.c
@@ -374,7 +374,7 @@ int main(int argc, char *argv[])
}
if (options.daemonize && daemon(0, 0)) {
- ERROR("Failed to daemonize: %p\n");
+ ERROR("Failed to daemonize: %m\n");
return THERMAL_ENGINE_DAEMON_ERROR;
}
--
2.51.0
Powered by blists - more mailing lists