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.

mei: bus: replace sprintf/scnprintf with sysfs_emit in show functions

Update all device attribute show callbacks in the MEI bus driver to use
sysfs_emit(), as recommended by Documentation/filesystems/sysfs.rst.

This improves consistency and aligns with current sysfs guidelines,
even though the existing use of sprintf/scnprintf is functionally safe.

Signed-off-by: Moon Hee Lee <moonhee.lee.ca@gmail.com>
Acked-by: Alexander Usyskin <alexander.usyskin@intel.com>
Link: https://lore.kernel.org/r/20250620181144.10750-1-moonhee.lee.ca@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Moon Hee Lee and committed by
Greg Kroah-Hartman
217592d0 86731a2a

+8 -9
+8 -9
drivers/misc/mei/bus.c
··· 1156 1156 { 1157 1157 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1158 1158 1159 - return scnprintf(buf, PAGE_SIZE, "%s", cldev->name); 1159 + return sysfs_emit(buf, "%s", cldev->name); 1160 1160 } 1161 1161 static DEVICE_ATTR_RO(name); 1162 1162 ··· 1166 1166 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1167 1167 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); 1168 1168 1169 - return sprintf(buf, "%pUl", uuid); 1169 + return sysfs_emit(buf, "%pUl", uuid); 1170 1170 } 1171 1171 static DEVICE_ATTR_RO(uuid); 1172 1172 ··· 1176 1176 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1177 1177 u8 version = mei_me_cl_ver(cldev->me_cl); 1178 1178 1179 - return sprintf(buf, "%02X", version); 1179 + return sysfs_emit(buf, "%02X", version); 1180 1180 } 1181 1181 static DEVICE_ATTR_RO(version); 1182 1182 ··· 1187 1187 const uuid_le *uuid = mei_me_cl_uuid(cldev->me_cl); 1188 1188 u8 version = mei_me_cl_ver(cldev->me_cl); 1189 1189 1190 - return scnprintf(buf, PAGE_SIZE, "mei:%s:%pUl:%02X:", 1191 - cldev->name, uuid, version); 1190 + return sysfs_emit(buf, "mei:%s:%pUl:%02X:", cldev->name, uuid, version); 1192 1191 } 1193 1192 static DEVICE_ATTR_RO(modalias); 1194 1193 ··· 1197 1198 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1198 1199 u8 maxconn = mei_me_cl_max_conn(cldev->me_cl); 1199 1200 1200 - return sprintf(buf, "%d", maxconn); 1201 + return sysfs_emit(buf, "%d", maxconn); 1201 1202 } 1202 1203 static DEVICE_ATTR_RO(max_conn); 1203 1204 ··· 1207 1208 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1208 1209 u8 fixed = mei_me_cl_fixed(cldev->me_cl); 1209 1210 1210 - return sprintf(buf, "%d", fixed); 1211 + return sysfs_emit(buf, "%d", fixed); 1211 1212 } 1212 1213 static DEVICE_ATTR_RO(fixed); 1213 1214 ··· 1217 1218 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1218 1219 bool vt = mei_me_cl_vt(cldev->me_cl); 1219 1220 1220 - return sprintf(buf, "%d", vt); 1221 + return sysfs_emit(buf, "%d", vt); 1221 1222 } 1222 1223 static DEVICE_ATTR_RO(vtag); 1223 1224 ··· 1227 1228 struct mei_cl_device *cldev = to_mei_cl_device(dev); 1228 1229 u32 maxlen = mei_me_cl_max_len(cldev->me_cl); 1229 1230 1230 - return sprintf(buf, "%u", maxlen); 1231 + return sysfs_emit(buf, "%u", maxlen); 1231 1232 } 1232 1233 static DEVICE_ATTR_RO(max_len); 1233 1234