Skip to contentSkip to conversation

tools/thermal/thermal-engine: Fix format string bug in thermal-engine

PATCH Applied Malaya Kumar Rout 2 participants 2 messages Nov 24, 2025 – Nov 25, 2025 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tools/thermal/thermal-engine/thermal-engine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/thermal/thermal-engine/thermal-engine.c +1 -1
index 0764dc754771..66b0ba1fcd23 100644
@@ -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;
 	}
 
Signature · 1 line
2.51.0
#1 lore raw
Quoted 11 lines · Malaya Kumar Rout

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.

---

Applied, thanks

Signature · 5 lines
<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