Skip to content

Commit e6ca59b

Browse files
ethancedwards8rafaeljw
authored andcommitted
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: KSPP#162 [1] Signed-off-by: Ethan Carter Edwards <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent d082ecb commit e6ca59b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/thermal_debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ void thermal_debug_tz_add(struct thermal_zone_device *tz)
876876

877877
tz_dbg->tz = tz;
878878

879-
tz_dbg->trips_crossed = kzalloc(sizeof(int) * tz->num_trips, GFP_KERNEL);
879+
tz_dbg->trips_crossed = kcalloc(tz->num_trips, sizeof(int), GFP_KERNEL);
880880
if (!tz_dbg->trips_crossed) {
881881
thermal_debugfs_remove_id(thermal_dbg);
882882
return;

0 commit comments

Comments
 (0)