[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250224173432.1946070-4-lukasz.luba@arm.com>
Date: Mon, 24 Feb 2025 17:33:05 +0000
From: Lukasz Luba <lukasz.luba@....com>
To: linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org,
rafael@...nel.org,
daniel.lezcano@...aro.org
Cc: lukasz.luba@....com,
rui.zhang@...el.com,
srinivas.pandruvada@...ux.intel.com
Subject: [PATCH 3/4] 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 changes.
Signed-off-by: Lukasz Luba <lukasz.luba@....com>
---
drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
index 8dca6a6aceca1..2d672c4be3ce5 100644
--- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
@@ -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;
--
2.48.1
Powered by blists - more mailing lists