Skip to content

Commit e6c0525

Browse files
lukaszluba-armrafaeljw
authored andcommitted
thermal: int340x: 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 <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 83c34f5 commit e6c0525

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
133133
if (ACPI_SUCCESS(status))
134134
int34x_zone->aux_trip_nr = trip_cnt;
135135

136-
zone_trips = kzalloc(sizeof(*zone_trips) * (trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT),
137-
GFP_KERNEL);
136+
zone_trips = kcalloc(trip_cnt + INT340X_THERMAL_MAX_TRIP_COUNT,
137+
sizeof(*zone_trips), GFP_KERNEL);
138138
if (!zone_trips) {
139139
ret = -ENOMEM;
140140
goto err_trips_alloc;

0 commit comments

Comments
 (0)