aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLukasz Luba <lukasz.luba@arm.com>2025-02-24 17:33:06 +0000
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2025-02-26 20:55:42 +0100
commit063ab16ff5cfa74aba25ec7efa08d2d016a429da (patch)
treec76f83350d47a7ee9600118924b34af6998440a6
parentthermal: int340x: Use kcalloc() instead of kzalloc() with multiplication (diff)
downloadwireguard-linux-063ab16ff5cfa74aba25ec7efa08d2d016a429da.tar.xz
wireguard-linux-063ab16ff5cfa74aba25ec7efa08d2d016a429da.zip
thermal: hisi: 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-5-lukasz.luba@arm.com [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/thermal/hisi_thermal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/thermal/hisi_thermal.c b/drivers/thermal/hisi_thermal.c
index 7e918bd3f100..4307161533a7 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;