]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (max6650) Replace sprintf() with sysfs_emit()
authorAmay Agarwal <tt@turingtested.xyz>
Tue, 3 Mar 2026 15:24:55 +0000 (20:54 +0530)
committerGuenter Roeck <linux@roeck-us.net>
Tue, 31 Mar 2026 02:45:05 +0000 (19:45 -0700)
Replace sprintf() with sysfs_emit() when writing to sysfs buffers.

sysfs_emit() performs proper bounds checking and is the preferred
helper for sysfs output.

No functional change intended.

Signed-off-by: Amay Agarwal <tt@turingtested.xyz>
Link: https://lore.kernel.org/r/20260303152456.35763-5-tt@turingtested.xyz
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/max6650.c

index 9649c6611d5f7a7390f8a4e0dd01dccff7236a38..56b8157885bbfd12aac02d97c150761fc7c4f140 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/hwmon-sysfs.h>
 #include <linux/err.h>
 #include <linux/of.h>
+#include <linux/sysfs.h>
 #include <linux/thermal.h>
 
 /*
@@ -312,7 +313,7 @@ static ssize_t alarm_show(struct device *dev,
                mutex_unlock(&data->update_lock);
        }
 
-       return sprintf(buf, "%d\n", alarm);
+       return sysfs_emit(buf, "%d\n", alarm);
 }
 
 static SENSOR_DEVICE_ATTR_RO(gpio1_alarm, alarm, MAX6650_ALRM_GPIO1);