Skip to content

Commit c65b5c5

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal/of: Use kcalloc() instead of kzalloc() with multiplication
According to the latest recommendations, kcalloc() should be used instead of kzalloc() with multiplication (which might overflow). Switch to this new scheme and use more safe kcalloc(). No functional impact. Signed-off-by: Lukasz Luba <lukasz.luba@arm.com> Link: https://patch.msgid.link/20250224173432.1946070-2-lukasz.luba@arm.com [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent e6ca59b commit c65b5c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thermal/thermal_of.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static struct thermal_trip *thermal_of_trips_init(struct device_node *np, int *n
107107
if (!count)
108108
return NULL;
109109

110-
struct thermal_trip *tt __free(kfree) = kzalloc(sizeof(*tt) * count, GFP_KERNEL);
110+
struct thermal_trip *tt __free(kfree) = kcalloc(count, sizeof(*tt), GFP_KERNEL);
111111
if (!tt)
112112
return ERR_PTR(-ENOMEM);
113113

0 commit comments

Comments
 (0)