summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEthan Carter Edwards <ethan@ethancedwards.com>2025-02-22 23:02:42 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2025-02-26 22:48:07 +0300
commite6ca59bb3c8f3fe00a9dc1ec72bcb77cd4ecd242 (patch)
treeb9a3f6fa77f691d33a534fb5ec7ce18eeb21a43b
parentd082ecbc71e9e0bf49883ee4afd435a77a5101b6 (diff)
downloadlinux-e6ca59bb3c8f3fe00a9dc1ec72bcb77cd4ecd242.tar.xz
thermal/debugfs: replace kzalloc() with kcalloc() in thermal_debug_tz_add()
Work is under way to get rid of all multiplications from allocation functions to prevent integer overflows [1]. Here the multiplication is obviously safe, but using kcalloc() is more appropriate and improves readability. This change has no effect on runtime behavior. Link: https://github.com/KSPP/linux/issues/162 [1] Signed-off-by: Ethan Carter Edwards <ethan@ethancedwards.com> Link: https://patch.msgid.link/20250222-thermal_kcalloc-v1-1-9f7a747fbed7@ethancedwards.com [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/thermal/thermal_debugfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
index c800504c3cfe..60ee6c366998 100644
--- a/drivers/thermal/thermal_debugfs.c
+++ b/drivers/thermal/thermal_debugfs.c
@@ -876,7 +876,7 @@ void thermal_debug_tz_add(struct thermal_zone_device *tz)
tz_dbg->tz = tz;
- tz_dbg->trips_crossed = kzalloc(sizeof(int) * tz->num_trips, GFP_KERNEL);
+ tz_dbg->trips_crossed = kcalloc(tz->num_trips, sizeof(int), GFP_KERNEL);
if (!tz_dbg->trips_crossed) {
thermal_debugfs_remove_id(thermal_dbg);
return;