Skip to content

Commit 75faabf

Browse files
tobluxrafaeljw
authored andcommitted
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 <thorsten.blum@linux.dev> [ rjw: Subject tweaks ] Link: https://patch.msgid.link/20260113082130.789891-2-thorsten.blum@linux.dev Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 47c9ef9 commit 75faabf

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/thermal/intel/therm_throt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/types.h>
2424
#include <linux/init.h>
2525
#include <linux/smp.h>
26+
#include <linux/sysfs.h>
2627
#include <linux/cpu.h>
2728

2829
#include <asm/processor.h>
@@ -144,8 +145,8 @@ static ssize_t therm_throt_device_show_##event##_##name( \
144145
\
145146
preempt_disable(); /* CPU hotplug */ \
146147
if (cpu_online(cpu)) { \
147-
ret = sprintf(buf, "%lu\n", \
148-
per_cpu(thermal_state, cpu).event.name); \
148+
ret = sysfs_emit(buf, "%lu\n", \
149+
per_cpu(thermal_state, cpu).event.name); \
149150
} else \
150151
ret = 0; \
151152
preempt_enable(); \

0 commit comments

Comments
 (0)