Commit 5ddd020b authored by Thorsten Blum's avatar Thorsten Blum Committed by Rafael J. Wysocki
Browse files

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: default avatarThorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
[ rjw: Subject tweaks ]
Link: https://patch.msgid.link/20260223073245.321298-2-thorsten.blum@linux.dev


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 11439c46
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -861,7 +861,7 @@ static int thermal_bind_cdev_to_trip(struct thermal_zone_device *tz,
		goto free_mem;

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