From: Thorsten Blum Date: Tue, 13 Jan 2026 08:21:26 +0000 (+0100) Subject: thermal: intel: Use sysfs_emit() in a sysfs show function X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75faabf6b92ad1d14fce8d45cf40f6db53cf96fd;p=thirdparty%2Fkernel%2Flinux.git thermal: intel: Use sysfs_emit() in a sysfs show function Replace sprintf() with sysfs_emit() in sysfs show functions. sysfs_emit() is preferred to format sysfs output as it provides better bounds checking. Signed-off-by: Thorsten Blum [ rjw: Subject tweaks ] Link: https://patch.msgid.link/20260113082130.789891-2-thorsten.blum@linux.dev Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/thermal/intel/therm_throt.c b/drivers/thermal/intel/therm_throt.c index debc94e2dc169..44fa4dd15dd1c 100644 --- a/drivers/thermal/intel/therm_throt.c +++ b/drivers/thermal/intel/therm_throt.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -144,8 +145,8 @@ static ssize_t therm_throt_device_show_##event##_##name( \ \ preempt_disable(); /* CPU hotplug */ \ if (cpu_online(cpu)) { \ - ret = sprintf(buf, "%lu\n", \ - per_cpu(thermal_state, cpu).event.name); \ + ret = sysfs_emit(buf, "%lu\n", \ + per_cpu(thermal_state, cpu).event.name); \ } else \ ret = 0; \ preempt_enable(); \