]> git.ipfire.org Git - thirdparty/linux.git/commit
powercap: Replace sprintf() with sysfs_emit() in sysfs show functions
authorSumeet Pawnikar <sumeet4linux@gmail.com>
Sun, 11 Jan 2026 14:12:36 +0000 (19:42 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 15 Jan 2026 20:12:04 +0000 (21:12 +0100)
commit07e5e811f86dcd6f595c3bbd71cde294e8545889
tree92a48f4e3f65e511c49a6a74f5fba097d498a88c
parent9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
powercap: Replace sprintf() with sysfs_emit() in sysfs show functions

Replace all sprintf() calls with sysfs_emit() in sysfs show functions.

sysfs_emit() is preferred over sprintf() for formatting sysfs output
as it provides better bounds checking and prevents potential buffer
overflows.

Also, replace sprintf() with sysfs_emit() in show_constraint_name()
and simplify the code by removing the redundant strlen() call since
sysfs_emit() returns the length.

Signed-off-by: Sumeet Pawnikar <sumeet4linux@gmail.com>
Link: https://patch.msgid.link/20260111141237.12340-1-sumeet4linux@gmail.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/powercap/powercap_sys.c