* [PATCH] tools/thermal/thermal-engine: Fix format string bug in thermal-engine
@ 2025-11-24 10:43 Malaya Kumar Rout
2025-11-25 9:00 ` Daniel Lezcano
0 siblings, 1 reply; 2+ messages in thread
From: Malaya Kumar Rout @ 2025-11-24 10:43 UTC (permalink / raw)
To: linux-kernel
Cc: mrout, malayarout91, Rafael J. Wysocki, Daniel Lezcano,
Zhang Rui, Lukasz Luba, linux-pm
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@redhat.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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tools/thermal/thermal-engine: Fix format string bug in thermal-engine
2025-11-24 10:43 [PATCH] tools/thermal/thermal-engine: Fix format string bug in thermal-engine Malaya Kumar Rout
@ 2025-11-25 9:00 ` Daniel Lezcano
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Lezcano @ 2025-11-25 9:00 UTC (permalink / raw)
To: Malaya Kumar Rout, linux-kernel
Cc: malayarout91, Rafael J. Wysocki, Zhang Rui, Lukasz Luba, linux-pm
On 11/24/25 11:43, Malaya Kumar Rout wrote:
> 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@redhat.com>
> ---
Applied, thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-25 9:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-24 10:43 [PATCH] tools/thermal/thermal-engine: Fix format string bug in thermal-engine Malaya Kumar Rout
2025-11-25 9:00 ` Daniel Lezcano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®