Skip to content

Commit 5ddd020

Browse files
tobluxrafaeljw
authored andcommitted
thermal: core: Replace sprintf() in thermal_bind_cdev_to_trip()
Replace unbounded sprintf() with the safer snprintf(). While the current code works correctly, snprintf() is safer and follows secure coding best practices. No functional changes. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> [ rjw: Subject tweaks ] Link: https://patch.msgid.link/20260223073245.321298-2-thorsten.blum@linux.dev Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 11439c4 commit 5ddd020

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thermal/thermal_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ static int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz,
861861
goto free_mem;
862862

863863
dev->id = result;
864-
sprintf(dev->name, "cdev%d", dev->id);
864+
snprintf(dev->name, sizeof(dev->name), "cdev%d", dev->id);
865865
result =
866866
sysfs_create_link(&tz->device.kobj, &cdev->device.kobj, dev->name);
867867
if (result)

0 commit comments

Comments
 (0)