Commit e6c0525f authored by Lukasz Luba's avatar Lukasz Luba Committed by Rafael J. Wysocki
Browse files

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: default avatarLukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/20250224173432.1946070-4-lukasz.luba@arm.com


[ rjw: Changelog edits ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 83c34f50
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -133,8 +133,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
	if (ACPI_SUCCESS(status))
		int34x_zone->aux_trip_nr = trip_cnt;

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