Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

thermal: intel: int340x: Replace sprintf() with sysfs_emit()

Replace sprintf() calls with sysfs_emit() in sysfs "show" functions to
follow current kernel coding standards.

sysfs_emit() is the preferred method for formatting sysfs output as it
provides better bounds checking and is more secure.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
[ rjw: Subject adjustments, changelog edits ]
Link: https://patch.msgid.link/20251030053410.311656-1-kaushlendra.kumar@intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Kaushlendra Kumar and committed by
Rafael J. Wysocki
347d92a7 90199078

+4 -4
+4 -4
drivers/thermal/intel/int340x_thermal/int3400_thermal.c
··· 114 114 int length = 0; 115 115 116 116 if (!priv->uuid_bitmap) 117 - return sprintf(buf, "UNKNOWN\n"); 117 + return sysfs_emit(buf, "UNKNOWN\n"); 118 118 119 119 for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) { 120 120 if (priv->uuid_bitmap & (1 << i)) ··· 131 131 int i, length = 0; 132 132 133 133 if (priv->current_uuid_index >= 0) 134 - return sprintf(buf, "%s\n", 134 + return sysfs_emit(buf, "%s\n", 135 135 int3400_thermal_uuids[priv->current_uuid_index]); 136 136 137 137 for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) { ··· 142 142 if (length) 143 143 return length; 144 144 145 - return sprintf(buf, "INVALID\n"); 145 + return sysfs_emit(buf, "INVALID\n"); 146 146 } 147 147 148 148 static int int3400_thermal_run_osc(acpi_handle handle, char *uuid_str, int *enable) ··· 342 342 343 343 odvp_attr = container_of(attr, struct odvp_attr, attr); 344 344 345 - return sprintf(buf, "%d\n", odvp_attr->priv->odvp[odvp_attr->odvp]); 345 + return sysfs_emit(buf, "%d\n", odvp_attr->priv->odvp[odvp_attr->odvp]); 346 346 } 347 347 348 348 static void cleanup_odvp(struct int3400_thermal_priv *priv)