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.

platform/x86/intel/uncore-freq: Replace sprintf() with sysfs_emit()

Replace sprintf() with sysfs_emit() in sysfs show functions. The
sysfs_emit() function is the preferred way to format sysfs output as
it ensures proper buffer bounds checking and correct return values.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Link: https://patch.msgid.link/20251230124516.229125-3-kaushlendra.kumar@intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Kaushlendra Kumar and committed by
Ilpo Järvinen
7b0a5195 050a0aab

+4 -4
+4 -4
drivers/platform/x86/intel/uncore-frequency/uncore-frequency-common.c
··· 26 26 { 27 27 struct uncore_data *data = container_of(attr, struct uncore_data, domain_id_kobj_attr); 28 28 29 - return sprintf(buf, "%u\n", data->domain_id); 29 + return sysfs_emit(buf, "%u\n", data->domain_id); 30 30 } 31 31 32 32 static ssize_t show_fabric_cluster_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) 33 33 { 34 34 struct uncore_data *data = container_of(attr, struct uncore_data, fabric_cluster_id_kobj_attr); 35 35 36 - return sprintf(buf, "%u\n", data->cluster_id); 36 + return sysfs_emit(buf, "%u\n", data->cluster_id); 37 37 } 38 38 39 39 static ssize_t show_package_id(struct kobject *kobj, struct kobj_attribute *attr, char *buf) 40 40 { 41 41 struct uncore_data *data = container_of(attr, struct uncore_data, package_id_kobj_attr); 42 42 43 - return sprintf(buf, "%u\n", data->package_id); 43 + return sysfs_emit(buf, "%u\n", data->package_id); 44 44 } 45 45 46 46 #define MAX_UNCORE_AGENT_TYPES 4 ··· 77 77 if (ret) 78 78 return ret; 79 79 80 - return sprintf(buf, "%u\n", value); 80 + return sysfs_emit(buf, "%u\n", value); 81 81 } 82 82 83 83 static ssize_t store_attr(struct uncore_data *data, const char *buf, ssize_t count,