]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe/pmu: Replace sprintf() with sysfs_emit()
authorMadhur Kumar <madhurkumar004@gmail.com>
Sun, 14 Dec 2025 08:36:59 +0000 (14:06 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Fri, 19 Dec 2025 15:30:31 +0000 (10:30 -0500)
Replace sprintf() calls with sysfs_emit() 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: Madhur Kumar <madhurkumar004@gmail.com>
Link: https://patch.msgid.link/20251214083659.2412218-1-madhurkumar004@gmail.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
[Rodrigo adjusted commit message while pushing it]

drivers/gpu/drm/xe/xe_pmu.c

index c63335eb69e575e61fe3637699489d82e192b7cd..0b20059dd7b3372065200a766e0ee232de068309 100644 (file)
@@ -425,7 +425,7 @@ static ssize_t event_attr_show(struct device *dev,
        struct perf_pmu_events_attr *pmu_attr =
                container_of(attr, struct perf_pmu_events_attr, attr);
 
-       return sprintf(buf, "event=%#04llx\n", pmu_attr->id);
+       return sysfs_emit(buf, "event=%#04llx\n", pmu_attr->id);
 }
 
 #define XE_EVENT_ATTR(name_, v_, id_)                                  \