From: Malaya Kumar Rout Date: Mon, 24 Nov 2025 10:43:58 +0000 (+0530) Subject: tools/thermal/thermal-engine: Fix format string bug in thermal-engine X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16e802667ed5c97a668b5eb3efb7615cb5f02832;p=thirdparty%2Fkernel%2Flinux.git 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 Signed-off-by: Daniel Lezcano Link: https://patch.msgid.link/20251124104401.374856-1-mrout@redhat.com --- diff --git a/tools/thermal/thermal-engine/thermal-engine.c b/tools/thermal/thermal-engine/thermal-engine.c index 0764dc7547715..66b0ba1fcd234 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; }