Message ID | 20250224173432.1946070-5-lukasz.luba@arm.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Thermal: clean-up with kcalloc() | expand |
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c index 7e918bd3f1002..4307161533a78 100644 --- a/drivers/thermal/hisi_thermal.c +++ b/drivers/thermal/hisi_thermal.c @@ -412,8 +412,8 @@ static int hi3660_thermal_probe(struct hisi_thermal_data *data) data->nr_sensors = 1; - data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) * - data->nr_sensors, GFP_KERNEL); + data->sensor = devm_kcalloc(dev, data->nr_sensors, + sizeof(*data->sensor), GFP_KERNEL); if (!data->sensor) return -ENOMEM;
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@arm.com> --- drivers/thermal/hisi_thermal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)